ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/NinoCode/learning/wxpython/Script2.py
Revision: 3
Committed: Sat May 5 03:52:28 2012 UTC (13 years, 10 months ago) by ninoborges
Content type: text/x-python
File size: 1393 byte(s)
Log Message:
Initial Import

File Contents

# User Rev Content
1 ninoborges 3 from wxPython.wx import *
2    
3     ID_ABOUT = 101
4     ID_EXIT = 102
5    
6     class MyFrame(wxFrame):
7     def __init__(self, parent, ID, title):
8     wxFrame.__init__(self, parent, ID, title,
9     wxDefaultPosition, wxSize(200, 150))
10     self.CreateStatusBar()
11     self.SetStatusText("This is the statusbar")
12    
13     menu = wxMenu()
14     menu.Append(ID_ABOUT, "&About",
15     "More information about this program")
16     menu.AppendSeparator()
17     menu.Append(ID_EXIT, "E&xit", "Terminate the program")
18    
19     menuBar = wxMenuBar()
20     menuBar.Append(menu, "&File");
21    
22     self.SetMenuBar(menuBar)
23     EVT_MENU(self, ID_ABOUT, self.OnAbout)
24     EVT_MENU(self, ID_EXIT, self.TimeToQuit)
25    
26     def OnAbout(self, event):
27     dlg = wxMessageDialog(self, "This sample program shows off\n"
28     "frames, menus, statusbars, and this\n"
29     "message dialog.",
30     "About Me", wxOK | wxICON_INFORMATION)
31     dlg.ShowModal()
32     dlg.Destroy()
33    
34    
35     def TimeToQuit(self, event):
36     self.Close(true)
37    
38    
39    
40     class MyApp(wxApp):
41     def OnInit(self):
42     frame = MyFrame(NULL, -1, "Hello from wxPython")
43     frame.Show(true)
44     self.SetTopWindow(frame)
45     return true
46    
47     app = MyApp(0)
48     app.MainLoop()