def __init__(self , browser): wx.wxMenu.__init__(self) self.ID_NEW_ENCOUNTER=1 self.ID_NEW_HEALTH_ISSUE=2 self.ID_NEW_EPISODE=3 self.__browser = browser self.__mediator = NarrativeTreeItemMediator1(browser) wx.EVT_MENU(self.__browser, self.ID_NEW_HEALTH_ISSUE , self.__mediator.new_health_issue) wx.EVT_MENU(self.__browser, self.ID_NEW_EPISODE , self.__mediator.new_episode)
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 addmenu(menu, text, callable): """Add an item to the menu""" id = wx.NewId() menu.Append(id, text) wx.EVT_MENU(menu, id, callable)