import wx
class MyFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title="Hello World")
panel = wx.Panel(self)
self.text = wx.StaticText(panel, label="Welcome to wxPython!", pos=(20, 20))
button = wx.Button(panel, label="Click Me", pos=(20, 50))
button.Bind(wx.EVT_BUTTON, self.on_button_click)
def on_button_click(self, event):
self.text.SetLabel("Button Clicked!")
if __name__ == "__main__":
app = wx.App()
frame = MyFrame()
frame.Show()
app.MainLoop()