def _createControls(self): # A Statusbar in the bottom of the window self.CreateStatusBar(1) sMsg = 'wxPython ' + wx.version() self.SetStatusText(sMsg) # Add a panel to the frame (needed under Windows to have a nice background) wx.Panel(self, wx.ID_ANY) # Create the menu bar menuBar = wx.MenuBar() # File menu menuFile = wx.Menu() menuFile.Append(wx.ID_EXIT) menuBar.Append(menuFile, wx.GetStockLabel(wx.ID_FILE)) # Help menu menuHelp = wx.Menu() menuHelp.Append(wx.ID_ABOUT) menuBar.Append(menuHelp, wx.GetStockLabel(wx.ID_HELP)) # Assigne the menubar self.SetMenuBar(menuBar) # On OS X, delete the created menus # as the About and Exit items are handled by the OS specific menu if wx.GetOsDescription()[:8] == 'Mac OS X': menuBar.Remove(1) del menuHelp menuBar.Remove(0) del menuFile
def _createControls(self): # A Statusbar in the bottom of the window self.CreateStatusBar(1) sMsg = 'wxPython ' + wx.version() self.SetStatusText(sMsg) # Menu bar menubar = wx.MenuBar() # File menu filemenu = wx.Menu() filemenu.Append(wx.ID_EXIT) menubar.Append(filemenu, wx.GetStockLabel(wx.ID_FILE)) # Help menu helpmenu = wx.Menu() helpmenu.Append(wx.ID_ABOUT) menubar.Append(helpmenu, wx.GetStockLabel(wx.ID_HELP)) self.SetMenuBar(menubar) # Add a panel to the frame (needed under Windows to have a nice background) pnl = wx.Panel(self, wx.ID_ANY) szrMain = wx.BoxSizer(wx.VERTICAL) szrMain.AddStretchSpacer(1) label = wx.StaticText(pnl, wx.ID_STATIC, _("Welcome from wxWidgets")) fnt = label.GetFont().MakeLarger().MakeLarger() label.SetFont(fnt) szrMain.Add(label, 0, wx.ALL | wx.ALIGN_CENTER, 10) szrMain.AddStretchSpacer(1) pnl.SetSizer(szrMain)
def _add_ellipses_to_menuitem(self, wx_id): plain = wx.GetStockLabel( wx_id, wx.STOCK_WITH_ACCELERATOR | wx.STOCK_WITH_MNEMONIC) # format of plain 'xxx[\tyyy]', example '&New\tCtrl+N' tab_index = plain.find("\t") if tab_index != -1: return plain[:tab_index] + "..." + plain[tab_index:] return plain + "..."
def _create_file_new_menu_item(self, file_menu): accel = wx.GetStockLabel( wx.ID_NEW, wx.STOCK_WITH_ACCELERATOR | wx.STOCK_WITH_MNEMONIC) accel = accel.split("\t", 1)[1] file_menu.Append(wx.ID_NEW, _("New...") + "\t" + accel, _("Create a new timeline")) self.shortcut_items[wx.ID_NEW] = file_menu.FindItemById(wx.ID_NEW) self.Bind(wx.EVT_MENU, self._mnu_file_new_on_click, id=wx.ID_NEW)
def AddWindowMenu(self, pMenuBar): if pMenuBar and self._pWindowMenu: pos = pMenuBar.FindMenu(wx.GetStockLabel(wx.ID_HELP, wx.STOCK_NOFLAGS)) if pos == wx.NOT_FOUND: pMenuBar.Append(self._pWindowMenu, _("&Window")) else: pMenuBar.Insert(pos, self._pWindowMenu, _("&Window"))
def __init__(self, parent): wx.Dialog.__init__(self, parent, title=wx.GetStockLabel(wx.ID_ABOUT, wx.STOCK_NOFLAGS)) self._createInterface() self.CenterOnParent()
def _createControls(self): # A Statusbar in the bottom of the window self.CreateStatusBar(1) sMsg = 'wxPython ' + wx.version() self.SetStatusText(sMsg) # Add a panel to the frame (needed under Windows to have a nice background) pnl = wx.Panel(self, wx.ID_ANY) szrMain = wx.BoxSizer(wx.VERTICAL) stbSzr = wx.StaticBoxSizer(wx.VERTICAL, pnl, 'Informations to show in the "About" box:') self._optInfos[Options.MINIMAL] = wx.RadioButton(pnl, wx.ID_ANY, 'Application\'s name only (minimal "About" box)', style=wx.RB_GROUP) stbSzr.Add(self._optInfos[Options.MINIMAL], 0, wx.ALL, 5) self._optInfos[Options.MAXIMAL] = wx.RadioButton(pnl, wx.ID_ANY, 'All available informations') stbSzr.Add(self._optInfos[Options.MAXIMAL], 0, wx.LEFT|wx.RIGHT|wx.BOTTOM, 5) self._optInfos[Options.CUSTOM] = wx.RadioButton(pnl, wx.ID_ANY, 'Let me select the informations I want to see') stbSzr.Add(self._optInfos[Options.CUSTOM], 0, wx.LEFT|wx.RIGHT, 5) lnSzr = wx.BoxSizer(wx.HORIZONTAL) lnSzr.AddSpacer(10) flxSzr = wx.FlexGridSizer(2, 5, 5) self._chkInfos[Details.APP_NAME] = wx.CheckBox(pnl, wx.ID_ANY, 'Application\'s name') self._chkInfos[Details.APP_NAME].Disable() flxSzr.Add(self._chkInfos[Details.APP_NAME]) self._chkInfos[Details.APP_VERSION] = wx.CheckBox(pnl, wx.ID_ANY, 'Application\'s version') flxSzr.Add(self._chkInfos[Details.APP_VERSION]) self._chkInfos[Details.APP_DESCRIPTION] = wx.CheckBox(pnl, wx.ID_ANY, 'Description') flxSzr.Add(self._chkInfos[Details.APP_DESCRIPTION]) self._chkInfos[Details.COPYRIGHT] = wx.CheckBox(pnl, wx.ID_ANY, 'Copyright') flxSzr.Add(self._chkInfos[Details.COPYRIGHT]) self._chkInfos[Details.ICON] = wx.CheckBox(pnl, wx.ID_ANY, 'Icon') flxSzr.Add(self._chkInfos[Details.ICON]) self._chkInfos[Details.LICENCE] = wx.CheckBox(pnl, wx.ID_ANY, 'Licence text') flxSzr.Add(self._chkInfos[Details.LICENCE]) self._chkInfos[Details.DEVELOPPER] = wx.CheckBox(pnl, wx.ID_ANY, 'Main developper') flxSzr.Add(self._chkInfos[Details.DEVELOPPER]) self._chkInfos[Details.DEVELOPPERS] = wx.CheckBox(pnl, wx.ID_ANY, 'Multiple developpers') flxSzr.Add(self._chkInfos[Details.DEVELOPPERS]) self._chkInfos[Details.WEBSITE] = wx.CheckBox(pnl, wx.ID_ANY, 'Website url') flxSzr.Add(self._chkInfos[Details.WEBSITE]) self._chkInfos[Details.TRANSLATORS] = wx.CheckBox(pnl, wx.ID_ANY, 'Translators') flxSzr.Add(self._chkInfos[Details.TRANSLATORS]) lnSzr.Add(flxSzr, 0, wx.ALL, 0) stbSzr.Add(lnSzr, 0, wx.ALL, 5) szrMain.Add(stbSzr, 1, wx.ALL|wx.EXPAND, 5) pnl.SetSizer(szrMain) # At startup, select the "All available infos" option self._optInfos[Options.MAXIMAL].SetValue(True) # Check the wxCheckBoxes depending on the defined array (see on top of this file) for i in iCheckedBoxes: self._chkInfos[i].SetValue(True) # Create the menu bar menuBar = wx.MenuBar() # File menu menuFile = wx.Menu() menuFile.Append(wx.ID_EXIT) menuBar.Append(menuFile, wx.GetStockLabel(wx.ID_FILE)) # Help menu menuHelp = wx.Menu() menuHelp.Append(wx.ID_ABOUT) menuBar.Append(menuHelp, wx.GetStockLabel(wx.ID_HELP)) # Assigne the menubar self.SetMenuBar(menuBar) # On OS X, delete the created menus # as the About and Exit items are handled by the OS specific menu if wx.GetOsDescription()[:8] == 'Mac OS X': menuBar.Remove(1) del menuHelp menuBar.Remove(0) del menuFile # Adjust window size szrMain.SetSizeHints(self)