Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
41 lines (28 loc) · 1021 Bytes

File metadata and controls

41 lines (28 loc) · 1021 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# button_events.py
import wx
class MyPanel(wx.Panel):
def __init__(self, parent):
super().__init__(parent)
button = wx.Button(self, label='Press Me')
button.Bind(wx.EVT_BUTTON, self.on_button1)
button2 = wx.Button(self, label='Second button')
button2.Bind(wx.EVT_BUTTON, self.on_button2)
main_sizer = wx.BoxSizer(wx.HORIZONTAL)
main_sizer.Add(button, proportion=1,
flag=wx.ALL | wx.CENTER | wx.EXPAND,
border=5)
main_sizer.Add(button2, 0, wx.ALL, 5)
self.SetSizer(main_sizer)
def on_button1(self, event):
print('You clicked the first button')
def on_button2(self, event):
print('You clicked the second button')
class MyFrame(wx.Frame):
def __init__(self):
super().__init__(None, title='Hello World')
panel = MyPanel(self)
self.Show()
if __name__ == '__main__':
app = wx.App(redirect=False)
frame = MyFrame()
app.MainLoop()
Morty Proxy This is a proxified and sanitized view of the page, visit original site.