Código Python:
Ver originalimport wx
from time import sleep
class MyFrame(wx.Frame):
def __init__(self, parent,id, title):
wx.Frame.__init__(self, parent,id, title,size=(700,700))
self.Panel = Panel(self)
self.Show()
class Panel(wx.Panel):
def __init__(self, *args, **kwargs):
wx.Panel.__init__(self, *args, **kwargs)
box = wx.BoxSizer(wx.VERTICAL)
box1 = wx.BoxSizer(wx.HORIZONTAL)
self.txt1 = wx.TextCtrl(self)
self.lbl1 = wx.StaticText(self, label='x: ')
box1.Add(self.lbl1)
box1.Add(self.txt1)
box.Add(box1)
self.bttn = wx.Button(self, label='Click me')
box.Add(self.bttn)
self.SetAutoLayout(True)
self.SetSizer(box)
self.Layout()
self.bttn.Bind(wx.EVT_BUTTON, self.OnClick)
def OnClick(self, event):
self.txt1.SetBackgroundColour(wx.Colour(255, 0, 0))
self.Refresh(False)
app = wx.App(0)
f = MyFrame(None,-1,"hola")
app.MainLoop()
Espero que esto te ayuda.