def OnInit(self): wxInitAllImageHandlers() # self.main = wxFrame1.create(None) # self.main = TestWindow(parent=self, log=None, frame=None) self.name = "Andy app" frame = wx.Frame( None, -1, "RunDemo: " + self.name, pos=(50, 50), size=(0, 0), style=wx.NO_FULL_REPAINT_ON_RESIZE | wx.DEFAULT_FRAME_STYLE, ) frame.CreateStatusBar() menuBar = wx.MenuBar() menu = wx.Menu() menu.Append(101, "E&xit\tAlt-X", "Exit demo") wx.EVT_MENU(self, 101, self.OnButton) menuBar.Append(menu, "&File") frame.SetMenuBar(menuBar) frame.Show(True) wx.EVT_CLOSE(frame, self.OnCloseFrame) # win = self.demoModule.runTest(frame, frame, Log()) win = runTest(frame, frame, Log()) # a window will be returned if the demo does not create # its own top-level window if win: # so set the frame to a good size for showing stuff frame.SetSize((640, 480)) win.SetFocus() self.window = win else: # otherwise the demo made its own frame, so just put a # button in this one if hasattr(frame, "otherWin"): b = wx.Button(frame, -1, " Exit ") frame.SetSize((200, 100)) wx.EVT_BUTTON(frame, b.GetId(), self.OnButton) else: # It was probably a dialog or something that is already # gone, so we're done. frame.Destroy() return True self.SetTopWindow(frame) # self.main.Show() # self.SetTopWindow(self.main) return True
def __init__(self, parent, id, title): frm = wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition,(845, 710)) self.CreateStatusBar() menuBar = wx.MenuBar() menu = wx.Menu() menu.Append(101, "&Select a File", "Select a file") menuBar.Append(menu, "&File") self.SetMenuBar(menuBar) self.Bind(wx.EVT_MENU, self.openfile, id=101)
def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition, wx.Size(750, 450)) self.FileName = '' hbox = wx.BoxSizer(wx.HORIZONTAL) vbox1 = wx.BoxSizer(wx.VERTICAL) vbox2 = wx.BoxSizer(wx.VERTICAL) vbox3 = wx.GridSizer(2, 2, 0, 0) vbox4 = wx.BoxSizer(wx.VERTICAL) panel = wx.Panel(self, -1) pnl1 = wx.Panel(self, -1, style=wx.SIMPLE_BORDER) pnl2 = wx.Panel(self, -1, style=wx.SIMPLE_BORDER) pnl3 = wx.Panel(self, -1, style=wx.SIMPLE_BORDER) self.rb1 = wx.RadioButton(pnl3, -1, 'IBI Map 1', (10, 10), style=wx.RB_GROUP) self.rb2 = wx.RadioButton(pnl3, -1, 'IBI Map 2', (10, 30)) self.rb3 = wx.RadioButton(pnl3, -1, 'IBI Map 3', (10, 50)) self.rb4 = wx.RadioButton(pnl3, -1, 'IBI Map 4', (10, 70)) self.rb5 = wx.RadioButton(pnl3, -1, 'IBI Map 5', (10, 90)) self.Bind(wx.EVT_RADIOBUTTON, self.SetVal, id=self.rb1.GetId()) self.Bind(wx.EVT_RADIOBUTTON, self.SetVal, id=self.rb2.GetId()) self.Bind(wx.EVT_RADIOBUTTON, self.SetVal, id=self.rb3.GetId()) self.Bind(wx.EVT_RADIOBUTTON, self.SetVal, id=self.rb4.GetId()) self.Bind(wx.EVT_RADIOBUTTON, self.SetVal, id=self.rb5.GetId()) self.SetVal(True) self.sc1 = wx.SpinCtrl(pnl3, -1, 'Start Frame', (15, 120), (80, -1), min=1, max=150000) self.sc2 = wx.SpinCtrl(pnl3, -1, 'Stop Frame', (15, 150), (80, -1), min=1, max=150000) wx.Button(pnl3, 82, 'Limits', (10, 200)) self.Bind(wx.EVT_BUTTON, self.OnLimits, id=82) self.CreateStatusBar() menuBar = wx.MenuBar() menu = wx.Menu() menu.Append(99, "&Message Dialog", "Shows a Message Dialog") menu.Append(100, "&Color Dialog", "Shows a Color Dialog") menu.Append(101, "&Open File", "Shows a File Dialog") menu.Append(102, "&Page Setup Dialog", "Shows a Page Setup Dialog") menu.Append(103, "&Font Dialog", "Shows a Font Dialog") menu.Append(104, "&Directory Dialog", "Shows a Directory Dialog") menu.Append(105, "&SingleChoice Dialog", "Shows a SingleChoice Dialog") menu.Append(106, "&TextEntry Dialog", "Shows a TextEntry Dialog") menuBar.Append(menu, "&Do Something") self.SetMenuBar(menuBar) self.lc = wx.ListCtrl(self, -1, style=wx.LC_REPORT) self.lc.InsertColumn(0, 'X') self.lc.InsertColumn(1, 'Y') self.lc.SetColumnWidth(0, 80) self.lc.SetColumnWidth(1, 80) vbox1.Add(pnl1, 1, wx.EXPAND | wx.ALL, 3) vbox1.Add(pnl2, 1, wx.EXPAND | wx.ALL, 3) vbox2.Add(self.lc, 1, wx.EXPAND | wx.ALL, 3) self.tc1 = wx.TextCtrl(pnl1, -1) self.tc2 = wx.TextCtrl(pnl1, -1) vbox3.AddMany([(wx.StaticText(pnl1, -1, 'X'), 0, wx.ALIGN_CENTER), (self.tc1, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL), (wx.StaticText(pnl1, -1, 'Y'), 0, wx.ALIGN_CENTER_HORIZONTAL), (self.tc2, 0)]) pnl1.SetSizer(vbox3) vbox4.Add(wx.Button(pnl2, 10, 'Add'), 0, wx.ALIGN_CENTER | wx.TOP, 10) vbox4.Add(wx.Button(pnl2, 11, 'Remove'), 0, wx.ALIGN_CENTER | wx.TOP, 10) vbox4.Add(wx.Button(pnl2, 12, 'Clear'), 0, wx.ALIGN_CENTER | wx.TOP, 10) vbox4.Add(wx.Button(pnl2, 13, 'Process'), 0, wx.ALIGN_CENTER | wx.TOP, 10) pnl2.SetSizer(vbox4) hbox.Add(panel, 1, wx.EXPAND) hbox.Add(vbox1, 1, wx.EXPAND) hbox.Add(vbox2, 1, wx.EXPAND) hbox.Add(pnl3, 1, wx.EXPAND) self.SetSizer(hbox) self.Bind(wx.EVT_BUTTON, self.OnAdd, id=10) self.Bind(wx.EVT_BUTTON, self.OnRemove, id=11) self.Bind(wx.EVT_BUTTON, self.OnClear, id=12) self.Bind(wx.EVT_BUTTON, self.OnProcess, id=13) self.Bind(wx.EVT_MENU, self.message, id=99) self.Bind(wx.EVT_MENU, self.choosecolor, id=100) self.Bind(wx.EVT_MENU, self.openfile, id=101) self.Bind(wx.EVT_MENU, self.pagesetup, id=102) self.Bind(wx.EVT_MENU, self.choosefont, id=103) self.Bind(wx.EVT_MENU, self.opendir, id=104) self.Bind(wx.EVT_MENU, self.singlechoice, id=105) self.Bind(wx.EVT_MENU, self.textentry, id=106) wx.Button(panel, 1, 'Show IBIs', (40, 50)) self.Bind(wx.EVT_BUTTON, self.OnShowIBIs, id=1) wx.Button(panel, 2, 'Show Time Series', (40, 100)) self.Bind(wx.EVT_BUTTON, self.OnShowTS, id=2) wx.Button(panel, 3, 'Show Map', (40, 150)) self.Bind(wx.EVT_BUTTON, self.OnShowTSa, id=3) wx.Button(panel, 4, 'Adjust Thresholds', (40, 200)) self.Bind(wx.EVT_BUTTON, self.OnShowSlider, id=4) wx.Button(panel, 5, 'Read Data', (40, 250)) self.Bind(wx.EVT_BUTTON, self.OnReadData, id=5) wx.Button(panel, 6, 'Show RetMap', (40, 300)) self.Bind(wx.EVT_BUTTON, self.OnShowRetMap, id=6) self.SetStatusText("Current Data File: %s" % self.FileName)