| 1 |
## GenericGUIAPP.py
|
| 2 |
## A starting point that I made that will be the starting point to all my GUI programs that
|
| 3 |
## need to be this interactive
|
| 4 |
## EBorges
|
| 5 |
## 8.28.03
|
| 6 |
|
| 7 |
## Summation_ViewerPy2.py
|
| 8 |
## EBorges
|
| 9 |
## 8.28.03
|
| 10 |
|
| 11 |
|
| 12 |
from wxPython.wx import *
|
| 13 |
|
| 14 |
|
| 15 |
ID_ABOUT = 101
|
| 16 |
ID_EXIT = 102
|
| 17 |
ID_NEW = 103
|
| 18 |
|
| 19 |
class MyFrame(wxFrame):
|
| 20 |
def __init__(self, parent, ID, title):
|
| 21 |
wxFrame.__init__(self, parent, ID, title,
|
| 22 |
wxDefaultPosition, wxSize(600, 500))
|
| 23 |
self.CreateStatusBar()
|
| 24 |
self.SetStatusText("Ready.")
|
| 25 |
# Create the File Menu <Start>
|
| 26 |
fileMenu = wxMenu()
|
| 27 |
fileMenu.Append(ID_NEW, "&New Project...",
|
| 28 |
"Create a new project.")
|
| 29 |
fileMenu.AppendSeparator()
|
| 30 |
fileMenu.Append(ID_EXIT, "E&xit", "Terminate the program")
|
| 31 |
|
| 32 |
mainMenuBar = wxMenuBar()
|
| 33 |
mainMenuBar.Append(fileMenu, "&File");
|
| 34 |
# File Menu <End>
|
| 35 |
|
| 36 |
# Creat Help Menu <Start>
|
| 37 |
helpMenu = wxMenu()
|
| 38 |
helpMenu.Append(ID_ABOUT, "&About",
|
| 39 |
"More information about this program")
|
| 40 |
#helpMenuBar = wxMenuBar()
|
| 41 |
mainMenuBar.Append(helpMenu, "&Help");
|
| 42 |
|
| 43 |
# Help Menu <End>
|
| 44 |
self.SetMenuBar(mainMenuBar)
|
| 45 |
|
| 46 |
EVT_MENU(self,ID_NEW, self.TimeToQuit)
|
| 47 |
EVT_MENU(self, ID_ABOUT, self.OnAbout)
|
| 48 |
EVT_MENU(self, ID_EXIT, self.TimeToQuit)
|
| 49 |
|
| 50 |
|
| 51 |
def OnAbout(self, event):
|
| 52 |
dlg = wxMessageDialog(self, "This program allows you to do\n"
|
| 53 |
"various things that extend Summaion.\n"
|
| 54 |
"For questions about this program please\n"
|
| 55 |
"please call x1606",
|
| 56 |
"About MW Summation Extensions", wxOK | wxICON_INFORMATION)
|
| 57 |
dlg.ShowModal()
|
| 58 |
dlg.Destroy()
|
| 59 |
|
| 60 |
|
| 61 |
def TimeToQuit(self, event):
|
| 62 |
self.Close(true)
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
class MyApp(wxApp):
|
| 67 |
def OnInit(self):
|
| 68 |
frame = MyFrame(NULL, -1, "MW Summation Extension")
|
| 69 |
frame.Show(true)
|
| 70 |
self.SetTopWindow(frame)
|
| 71 |
return true
|
| 72 |
|
| 73 |
app = MyApp(0)
|
| 74 |
app.MainLoop() |