]>
Commit | Line | Data |
---|---|---|
be05b434 RD |
1 | #!/usr/bin/env python |
2 | ||
3 | import wx | |
4 | ||
5 | class MenuEventFrame(wx.Frame): | |
6 | ||
7 | def __init__(self, parent, id): | |
8 | wx.Frame.__init__(self, parent, id, 'Menus', size=(300, 200)) | |
9 | menuBar = wx.MenuBar() | |
10 | menu1 = wx.Menu() | |
11 | menuItem = menu1.Append(-1, "&Exit...") | |
12 | menuBar.Append(menu1, "&File") | |
13 | self.SetMenuBar(menuBar) | |
14 | self.Bind(wx.EVT_MENU, self.OnCloseMe, menuItem) | |
15 | ||
16 | def OnCloseMe(self, event): | |
17 | self.Close(True) | |
18 | ||
19 | if __name__ == '__main__': | |
20 | app = wx.PySimpleApp() | |
21 | frame = MenuEventFrame(parent=None, id=-1) | |
22 | frame.Show() | |
23 | app.MainLoop() | |
24 |