我们从Python开源项目中,提取了以下28个代码示例,用于说明如何使用wx.BOTH。
def __init__( self, parent ): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"Encrypted Files", pos = wx.DefaultPosition, size = wx.Size( 600,400 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) BodySizer = wx.BoxSizer( wx.VERTICAL ) self.m_panel4 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) TextCtrlSizer = wx.BoxSizer( wx.VERTICAL ) self.EncryptedFilesTextCtrl = wx.TextCtrl( self.m_panel4, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_DONTWRAP|wx.TE_MULTILINE|wx.TE_READONLY ) TextCtrlSizer.Add( self.EncryptedFilesTextCtrl, 1, wx.ALL|wx.EXPAND, 5 ) self.m_panel4.SetSizer( TextCtrlSizer ) self.m_panel4.Layout() TextCtrlSizer.Fit( self.m_panel4 ) BodySizer.Add( self.m_panel4, 1, wx.EXPAND |wx.ALL, 5 ) self.SetSizer( BodySizer ) self.Layout() self.Centre( wx.BOTH )
def PrintPreview(self): """Print-preview current plot.""" printout = PlotPrintout(self) printout2 = PlotPrintout(self) self.preview = wx.PrintPreview(printout, printout2, self.print_data) if not self.preview.IsOk(): wx.MessageDialog(self, "Print Preview failed.\n" "Check that default printer is configured\n", "Print error", wx.OK | wx.CENTRE).ShowModal() self.preview.SetZoom(40) # search up tree to find frame instance frameInst = self while not isinstance(frameInst, wx.Frame): frameInst = frameInst.GetParent() frame = wx.PreviewFrame(self.preview, frameInst, "Preview") frame.Initialize() frame.SetPosition(self.GetPosition()) frame.SetSize((600, 550)) frame.Centre(wx.BOTH) frame.Show(True)
def __init__(self, parent): wx.Frame.__init__(self, parent, title=u"My Frame") self.model = WatchableDict() self.model["text"] = "" sizer = wx.BoxSizer(wx.VERTICAL) self.text_ctrl = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) sizer.Add(self.text_ctrl, 0, 0, 0) pywatch.wx.ValueChanger(self.text_ctrl, self.model, "text") self.static_text = wx.StaticText(self, wx.ID_ANY, u"Text: {0}", wx.DefaultPosition, wx.DefaultSize, 0) sizer.Add(self.static_text, 0, 0, 0) pywatch.wx.LabelWatcher(self.static_text, self.model, "text") self.SetSizer(sizer) self.Centre(wx.BOTH)
def OnAdd(self, evt): dialog = wx.TextEntryDialog(self, "Enter name:", "Add", style = wx.OK | wx.CANCEL) dialog.Centre(wx.BOTH) if dialog.ShowModal() == wx.ID_OK: name = dialog.GetValue() if name not in ("CURRENT", ) and name not in self.all_hosts: fpath = os.path.join(DataPath, name) shutil.copy(os.path.join(DataPath, "default"), fpath) call_editor(fpath) self.all_hosts.append(name) self.combo_box_1.AppendItems([name]) else: msg_dialog = wx.MessageDialog(self, "Failed to create \"%s\".\nFile already exists." % name, 'Failed to create "%s"' % name, wx.OK | wx.ICON_ERROR) msg_dialog.Centre(wx.BOTH) msg_dialog.ShowModal() msg_dialog.Destroy() dialog.Destroy()
def OnDelete(self, evt): name = self.combo_box_1.GetValue() fpath = os.path.join(DataPath, name) if name != "default": msg_dialog = wx.MessageDialog(self, "Are you sure that you want to delete file \"%s\"" % name, "Delete \"%s\"" % name, wx.YES_NO | wx.ICON_EXCLAMATION) msg_dialog.Centre(wx.BOTH) r = msg_dialog.ShowModal() if r == wx.ID_YES: if os.path.exists(fpath) and os.path.isfile(fpath): os.remove(fpath) index = self.combo_box_1.GetSelection() self.combo_box_1.Delete(index) self.combo_box_1.Select(0) msg_dialog.Destroy() else: msg_dialog = wx.MessageDialog(self, "\"%s\" can't be deleted.\nYou can edit it only." % name, "\"%s\" can't be deleted." % name, wx.OK | wx.ICON_ERROR) msg_dialog.Centre(wx.BOTH) msg_dialog.ShowModal() msg_dialog.Destroy()
def OnSet(self, evt): name = self.combo_box_1.GetValue() fpath = os.path.join(DataPath, name) msg_dialog = wx.MessageDialog(self, "Are you sure that you want to set file \"%s\" as current hosts" % name, "Set \"%s\"" % name, wx.YES_NO | wx.ICON_EXCLAMATION) msg_dialog.Centre(wx.BOTH) r = msg_dialog.ShowModal() if r == wx.ID_YES: with open(fpath, "rb") as fp_src: with open("/etc/hosts", "wb") as fp_des: fp_des.write(fp_src.read()) self.current = name with open(CurrentHosts, "wb") as fp: fp.write(name) self.statusbar.SetStatusText("Current: %s" % self.current) msg_dialog.Destroy()
def OnInit(self): frame = TaskBarApp(None, -1, ' ') frame.Center(wx.BOTH) frame.Show(False) return True
def __init__(self, parent): wx.Dialog.__init__(self, parent, wx.ID_ANY, "About NodeMCU PyFlasher") html = HtmlWindow(self, wx.ID_ANY, size=(420, -1)) if "gtk2" in wx.PlatformInfo or "gtk3" in wx.PlatformInfo: html.SetStandardFonts() txt = self.text.format(self._get_bundle_dir(), __version__) html.SetPage(txt) ir = html.GetInternalRepresentation() html.SetSize((ir.GetWidth() + 25, ir.GetHeight() + 25)) self.SetClientSize(html.GetSize()) self.CentreOnParent(wx.BOTH)
def __init__(self, parent, title): wx.Frame.__init__(self, parent, -1, title, size=(700, 650), style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE) self._config = FlashConfig.load(self._get_config_file_path()) self._build_status_bar() self._set_icons() self._build_menu_bar() self._init_ui() sys.stdout = RedirectText(self.console_ctrl) self.SetMinSize((640, 480)) self.Centre(wx.BOTH) self.Show(True)
def __init__( self, parent ): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( 1200,800 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) self.Layout() self.Centre( wx.BOTH )
def __init__(self, message, title): wx.Dialog.__init__(self, None, -1, title,size=(300, 120)) self.CenterOnScreen(wx.BOTH) text = wx.StaticText(self, -1, message) ok = wx.Button(self, wx.ID_OK, "???????????????") ok.SetDefault() vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(text, 1, wx.ALIGN_CENTER|wx.TOP, 10) vbox.Add(ok, 1, wx.ALIGN_CENTER|wx.BOTTOM, 10) self.SetSizer(vbox)
def __init__(self, parent): # Translators: The title of a dialog to configure advanced WinTenApps add-on options such as update checking. super(WinTenAppsConfigDialog, self).__init__(parent, title=_("Windows 10 App Essentials settings")) mainSizer = wx.BoxSizer(wx.VERTICAL) w10Helper = gui.guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) # Translators: A checkbox to toggle automatic add-on updates. self.autoUpdateCheckbox=w10Helper.addItem(wx.CheckBox(self,label=_("Automatically check for add-on &updates"))) self.autoUpdateCheckbox.SetValue(config.conf["wintenApps"]["autoUpdateCheck"]) # Translators: The label for a setting in WinTenApps add-on settings to select automatic update interval in days. self.updateInterval=w10Helper.addLabeledControl(_("Update &interval in days"), gui.nvdaControls.SelectOnFocusSpinCtrl, min=0, max=30, initial=config.conf["wintenApps"]["updateCheckTimeInterval"]) # Translators: The label for a combo box to select update channel. labelText = _("&Add-on update channel:") self.channels=w10Helper.addLabeledControl(labelText, wx.Choice, choices=["development", "stable"]) self.updateChannels = ("dev", "stable") self.channels.SetSelection(self.updateChannels.index(config.conf["wintenApps"]["updateChannel"])) if canUpdate: # Translators: The label of a button to check for add-on updates. updateCheckButton = w10Helper.addItem(wx.Button(self, label=_("Check for add-on &update"))) updateCheckButton.Bind(wx.EVT_BUTTON, self.onUpdateCheck) w10Helper.addDialogDismissButtons(self.CreateButtonSizer(wx.OK | wx.CANCEL)) self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK) self.Bind(wx.EVT_BUTTON, self.onCancel, id=wx.ID_CANCEL) mainSizer.Add(w10Helper.sizer, border=gui.guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) mainSizer.Fit(self) self.Sizer = mainSizer self.autoUpdateCheckbox.SetFocus() self.Center(wx.BOTH | (wx.CENTER_ON_SCREEN if hasattr(wx, "CENTER_ON_SCREEN") else 2))
def __init__(self, parent, title='Frame3D', manager=None): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = title, pos = wx.DefaultPosition, size = wx.Size( 800,600 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) sizer = wx.BoxSizer( wx.VERTICAL ) root = os.path.abspath(os.path.dirname(__file__)) self.SetIcon(wx.Icon(os.path.join(root, 'imgs/logo.ico'), wx.BITMAP_TYPE_ICO)) self.viewer = canvas3d.Viewer3D( self , manager) sizer.Add( self.viewer, 1, wx.EXPAND |wx.ALL, 0 ) self.Bind(wx.EVT_CLOSE, self.on_closing) self.SetSizer( sizer ) self.Layout() self.Centre( wx.BOTH )
def __init__( self, parent ): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = 'ImagePy', size = wx.Size(-1,-1), pos = wx.DefaultPosition, style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) logopath = os.path.join(root_dir, 'data/logo.ico') #self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DLIGHT ) ) self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO)) self.SetSizeHints( wx.Size( 600,-1 ), wx.DefaultSize ) IPy.curapp = self # Todo:Fixed absolute/relative path! # print("menuspath:{}".format( os.path.join(root_dir,"menus"))) # print("toolspath:{}".format(os.path.join(root_dir,"tools")) # menuspath = os.path.join(root_dir, "menus") # toolspath = os.path.join(root_dir,"tools") self.menubar = pluginloader.buildMenuBarByPath(self, 'menus') self.SetMenuBar( self.menubar ) self.shortcut = pluginloader.buildShortcut(self) self.SetAcceleratorTable(self.shortcut) sizer = wx.BoxSizer(wx.VERTICAL) self.toolbar = toolsloader.build_tools(self, 'tools') #self.toolbar.Realize() #sizertool.Add(self.toolbar, 1, 0, 5 ) #sizertool.Add(self.morebar, 0, 0, 5) sizer.Add(self.toolbar, 0, wx.EXPAND, 5 ) #sizer.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) self.line_color = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) #self.line_color.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_HIGHLIGHT ) ) sizer.AddStretchSpacer(prop=1) sizer.Add(self.line_color, 0, wx.EXPAND |wx.ALL, 0 ) stapanel = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) sizersta = wx.BoxSizer( wx.HORIZONTAL ) self.txt_info = wx.StaticText( stapanel, wx.ID_ANY, "ImagePy v0.2", wx.DefaultPosition, wx.DefaultSize, 0 ) self.txt_info.Wrap( -1 ) #self.txt_info.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_INFOBK ) ) sizersta.Add( self.txt_info, 1, wx.ALIGN_BOTTOM|wx.BOTTOM|wx.LEFT|wx.RIGHT, 2 ) self.pro_bar = wx.Gauge( stapanel, wx.ID_ANY, 100, wx.DefaultPosition, wx.Size( 100,15 ), wx.GA_HORIZONTAL ) sizersta.Add( self.pro_bar, 0, wx.ALIGN_BOTTOM|wx.BOTTOM|wx.LEFT|wx.RIGHT, 2 ) stapanel.SetSizer(sizersta) stapanel.SetDropTarget(FileDrop()) sizer.Add(stapanel, 0, wx.EXPAND, 5 ) self.SetSizer( sizer ) self.Centre( wx.BOTH ) self.Layout() self.Fit() self.update = False self.Bind(wx.EVT_CLOSE, self.on_close) thread = threading.Thread(None, self.hold, ()) thread.setDaemon(True) thread.start()
def __init__( self, parent, title): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = title, pos = wx.DefaultPosition, size = wx.Size( 500,300 ) ) logopath = os.path.join(root_dir, 'data/logo.ico') self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DLIGHT ) ) self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO)) self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) sizer = wx.BoxSizer( wx.VERTICAL ) self.canvas = LineCanvas( self) #self.canvas.set_data(np.random.rand(256)*100) #self.canvas.set_lim(0, 0) sizer.Add( self.canvas, 1, wx.EXPAND |wx.ALL, 5 ) sizer2 = wx.BoxSizer( wx.HORIZONTAL ) self.lab_info = wx.StaticText( self, wx.ID_ANY, "Information", wx.DefaultPosition, wx.DefaultSize, 0 ) self.lab_info.Wrap( -1 ) sizer2.Add( self.lab_info, 0, wx.ALL, 5 ) sizer2.AddStretchSpacer(1) self.btn_save = wx.Button( self, wx.ID_ANY, "Save", wx.DefaultPosition, wx.DefaultSize, 0 ) sizer2.Add( self.btn_save, 0, wx.ALL, 5 ) self.btn_cancel = wx.Button( self, wx.ID_ANY, "Cancel", wx.DefaultPosition, wx.DefaultSize, 0 ) sizer2.Add( self.btn_cancel, 0, wx.ALL, 5 ) sizer.Add( sizer2, 0, wx.ALL|wx.EXPAND, 5 ) self.SetSizer( sizer ) self.Layout() self.Centre( wx.BOTH ) self.canvas.handle_move = self.handle_move self.Bind(wx.EVT_CLOSE, self.on_closing) self.btn_cancel.Bind(wx.EVT_BUTTON, self.on_cancel) self.btn_save.Bind(wx.EVT_BUTTON, self.on_save) self.set_title_label = self.canvas.set_title_label self.add_data = self.canvas.add_data self.clear = self.canvas.clear
def __init__( self, parent,): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = 'Plugin List', pos = wx.DefaultPosition, size = wx.Size( 612,500 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) logopath = os.path.join(root_dir, 'data/logo.ico') self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DLIGHT ) ) self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO)) self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) bSizer1 = wx.BoxSizer( wx.VERTICAL ) bSizer2 = wx.BoxSizer( wx.HORIZONTAL ) self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, "Search:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText1.Wrap( -1 ) bSizer2.Add( self.m_staticText1, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.txt_search = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer2.Add( self.txt_search, 1, wx.ALL, 5 ) bSizer1.Add( bSizer2, 0, wx.EXPAND, 5 ) self.lst_plgs = VirtualListCtrl( self, ['Name', 'Location']) self.lst_plgs.SetColumnWidth(0,200) self.lst_plgs.SetColumnWidth(1,400) bSizer1.Add( self.lst_plgs, 1, wx.ALL|wx.EXPAND, 5 ) self.SetSizer( bSizer1 ) self.Layout() self.Centre( wx.BOTH ) # Connect Events self.txt_search.Bind( wx.EVT_TEXT, self.on_search ) self.lst_plgs.Bind( wx.EVT_LIST_ITEM_ACTIVATED, self.on_run ) self.load()
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"Background Task", pos=wx.DefaultPosition, size=wx.Size(500, 300), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) sizer = wx.BoxSizer(wx.VERTICAL) gb_sizer = wx.GridBagSizer(5, 5) gb_sizer.SetFlexibleDirection(wx.BOTH) gb_sizer.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.gauge = wx.Gauge(self, wx.ID_ANY, 10 ** 3, wx.DefaultPosition, wx.DefaultSize, wx.GA_HORIZONTAL) self.gauge.SetValue(0) gb_sizer.Add(self.gauge, wx.GBPosition(0, 0), wx.GBSpan(1, 1), wx.EXPAND, 0) self.button = wx.Button(self, wx.ID_ANY, u"Run", wx.DefaultPosition, wx.DefaultSize, 0) gb_sizer.Add(self.button, wx.GBPosition(1, 0), wx.GBSpan(1, 1), wx.EXPAND, 0) gb_sizer.AddGrowableCol(0) sizer.Add(gb_sizer, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(sizer) self.Layout() self.Centre(wx.BOTH) # Connect Events self.button.Bind(wx.EVT_BUTTON, self.on_run) self.model = WatchableDict() self.model["complete"] = 0 pywatch.wx.ValueWatcher(self.gauge, self.model, "complete") # Virtual event handlers, overide them in your derived class
def __init__( self, parent ): wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"About", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE ) self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) bSizer8 = wx.BoxSizer( wx.VERTICAL ) self.m_notebookAbout = wx.Notebook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_panelAbout = wx.Panel( self.m_notebookAbout, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) bSizer10 = wx.BoxSizer( wx.VERTICAL ) bSizer10.AddSpacer( ( 0, 0), 1, wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL, 5 ) self.m_staticTextAppNameVersion = wx.StaticText( self.m_panelAbout, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE ) self.m_staticTextAppNameVersion.Wrap( -1 ) bSizer10.Add( self.m_staticTextAppNameVersion, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 ) self.m_staticTextCopyright = wx.StaticText( self.m_panelAbout, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE ) self.m_staticTextCopyright.Wrap( -1 ) bSizer10.Add( self.m_staticTextCopyright, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 ) self.m_hyperlinkURL = wx.HyperlinkCtrl( self.m_panelAbout, wx.ID_ANY, u"wxFB Website", u"http://www.wxformbuilder.org", wx.DefaultPosition, wx.DefaultSize, wx.HL_ALIGN_CENTRE|wx.HL_DEFAULT_STYLE ) bSizer10.Add( self.m_hyperlinkURL, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 ) bSizer10.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) self.m_panelAbout.SetSizer( bSizer10 ) self.m_panelAbout.Layout() bSizer10.Fit( self.m_panelAbout ) self.m_notebookAbout.AddPage( self.m_panelAbout, u"About", True ) bSizer8.Add( self.m_notebookAbout, 1, wx.EXPAND |wx.ALL, 5 ) self.m_buttonClose = wx.Button( self, wx.ID_ANY, u"Close", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer8.Add( self.m_buttonClose, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 ) self.SetSizer( bSizer8 ) self.Layout() bSizer8.Fit( self ) self.Centre( wx.BOTH )
def __init__(self, parent, raw_header_str, caption, pos=wx.DefaultPosition, size=(500,300), style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER): self.parent = parent wx.Dialog.__init__(self, parent, -1, caption, pos, size, style) x, y = pos if x == -1 and y == -1: self.CenterOnScreen(wx.BOTH) self.cur_selection = (0, 0) self.raw_header_str = raw_header_str self.raw_header_str_lower = raw_header_str.lower() self.text = text = wx.TextCtrl(self, -1, raw_header_str, style=wx.TE_MULTILINE | wx.TE_READONLY) font1 = wx.Font(12, wx.FONTFAMILY_MODERN, wx.NORMAL, wx.FONTWEIGHT_LIGHT, False) self.text.SetFont(font1) self.text.SetInitialSize((600,400)) main_sizer = wx.BoxSizer(wx.VERTICAL) main_sizer.Add(self.text, 1, wx.EXPAND | wx.ALL, border=5) ok = wx.Button(self, wx.ID_OK, "OK") ok.SetDefault() ok.Bind(wx.EVT_BUTTON, self.on_close) buttons_sizer = wx.BoxSizer(wx.HORIZONTAL) self.search = wx.SearchCtrl(self, size=(200, -1), style=wx.TE_PROCESS_ENTER) self.search.ShowSearchButton(True) self.search.ShowCancelButton(True) # TODO: make layout of search & OK button prettier (OK should be right-aligned properly) buttons_sizer.Add(self.search, 0, wx.ALL | wx.EXPAND) buttons_sizer.Add((315, 0), 1, wx.EXPAND) buttons_sizer.Add(ok, 0, wx.ALL) main_sizer.Add(buttons_sizer, 0, wx.ALL, border=4) self.SetSizerAndFit(main_sizer) self.set_cur_selection() self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.on_search, self.search) self.Bind(wx.EVT_TEXT_ENTER, self.on_search, self.search) self.last_search_str = '' self.last_find_index = 0 self.is_dialog_still_open = True self.Bind(wx.EVT_CLOSE, self.on_close) new_id = wx.NewId() self.Bind(wx.EVT_MENU, self.on_cmd_w, id=new_id) self.SetAcceleratorTable(wx.AcceleratorTable([(wx.ACCEL_CMD, ord(str('w')), new_id)]))
def __init__( self, parent ): wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Teardrops", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.CAPTION|wx.CLOSE_BOX|wx.DEFAULT_DIALOG_STYLE ) self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) bvs_main = wx.BoxSizer( wx.VERTICAL ) rbx_actionChoices = [ u"Set Teardrops", u"Remove All Teardrops" ] self.rbx_action = wx.RadioBox( self, wx.ID_ANY, u"Action", wx.DefaultPosition, wx.DefaultSize, rbx_actionChoices, 1, wx.RA_SPECIFY_ROWS ) self.rbx_action.SetSelection( 0 ) bvs_main.Add( self.rbx_action, 0, wx.ALL, 5 ) gs_params = wx.GridSizer( 0, 2, 0, 0 ) self.st_hpercent = wx.StaticText( self, wx.ID_ANY, u"Horizontal percent", wx.DefaultPosition, wx.DefaultSize, 0 ) self.st_hpercent.Wrap( -1 ) gs_params.Add( self.st_hpercent, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 ) self.sp_hpercent = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 30 ) gs_params.Add( self.sp_hpercent, 0, wx.ALL|wx.SHAPED, 5 ) self.st_vpercent = wx.StaticText( self, wx.ID_ANY, u"Vertical percent", wx.DefaultPosition, wx.DefaultSize, 0 ) self.st_vpercent.Wrap( -1 ) gs_params.Add( self.st_vpercent, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 ) self.sp_vpercent = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 70 ) gs_params.Add( self.sp_vpercent, 0, wx.ALL|wx.SHAPED, 5 ) self.st_nbseg = wx.StaticText( self, wx.ID_ANY, u"Number of segments", wx.DefaultPosition, wx.DefaultSize, 0 ) self.st_nbseg.Wrap( -1 ) gs_params.Add( self.st_nbseg, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 ) self.sp_nbseg = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 2, 100, 10 ) gs_params.Add( self.sp_nbseg, 0, wx.ALL|wx.SHAPED, 5 ) bvs_main.Add( gs_params, 1, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND|wx.SHAPED, 5 ) bhs_modal = wx.BoxSizer( wx.HORIZONTAL ) bhs_modal.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) self.but_cancel = wx.Button( self, wx.ID_ANY, u"Cancel", wx.DefaultPosition, wx.DefaultSize, 0 ) bhs_modal.Add( self.but_cancel, 0, wx.ALIGN_RIGHT|wx.EXPAND, 5 ) self.but_ok = wx.Button( self, wx.ID_ANY, u"Ok", wx.DefaultPosition, wx.DefaultSize, 0 ) bhs_modal.Add( self.but_ok, 0, 0, 5 ) bvs_main.Add( bhs_modal, 0, wx.EXPAND, 5 ) self.SetSizer( bvs_main ) self.Layout() bvs_main.Fit( self ) self.Centre( wx.BOTH )
def __init__( self, parent ): wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"About", pos = wx.DefaultPosition, size = wx.Size( 800,512 ), style = wx.DEFAULT_DIALOG_STYLE ) self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) Sizer = wx.BoxSizer( wx.VERTICAL ) self.Panel = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) SizerC1 = wx.BoxSizer( wx.VERTICAL ) SizerText = wx.BoxSizer( wx.VERTICAL ) self.AppName = wx.StaticText( self.Panel, wx.ID_ANY, u"Turrican 2 Editor", wx.DefaultPosition, wx.DefaultSize, 0 ) self.AppName.Wrap( -1 ) self.AppName.SetFont( wx.Font( wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False, wx.EmptyString ) ) SizerText.Add( self.AppName, 0, wx.LEFT|wx.RIGHT|wx.TOP, 8 ) self.AppVersion = wx.StaticText( self.Panel, wx.ID_ANY, u"Version 1.0.2", wx.DefaultPosition, wx.DefaultSize, 0 ) self.AppVersion.Wrap( -1 ) SizerText.Add( self.AppVersion, 0, wx.BOTTOM|wx.LEFT|wx.RIGHT, 8 ) self.License = wx.TextCtrl( self.Panel, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_DONTWRAP|wx.TE_MULTILINE|wx.TE_READONLY|wx.NO_BORDER ) self.License.SetFont( wx.Font( 9, 75, 90, 90, False, "Courier New" ) ) self.License.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_BTNFACE ) ) SizerText.Add( self.License, 1, wx.ALL|wx.EXPAND, 8 ) SizerC1.Add( SizerText, 1, wx.EXPAND, 5 ) SizerButton = wx.BoxSizer( wx.HORIZONTAL ) SizerButton.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) self.Ok = wx.Button( self.Panel, wx.ID_ANY, u"Ok", wx.DefaultPosition, wx.DefaultSize, 0 ) self.Ok.SetDefault() SizerButton.Add( self.Ok, 0, wx.ALIGN_RIGHT|wx.ALL, 5 ) SizerC1.Add( SizerButton, 0, wx.EXPAND, 5 ) self.Panel.SetSizer( SizerC1 ) self.Panel.Layout() SizerC1.Fit( self.Panel ) Sizer.Add( self.Panel, 1, wx.EXPAND |wx.ALL, 8 ) self.SetSizer( Sizer ) self.Layout() self.Centre( wx.BOTH ) # Connect Events self.Ok.Bind( wx.EVT_BUTTON, self.ok )
def __init__( self, parent ): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = "Plugins Tree", pos = wx.DefaultPosition, size = wx.Size( 452,300 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) logopath = os.path.join(root_dir, 'data/logo.ico') self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DLIGHT ) ) self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO)) self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) bSizer1 = wx.BoxSizer( wx.HORIZONTAL ) self.tre_plugins = wx.TreeCtrl( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TR_DEFAULT_STYLE ) self.tre_plugins.SetMinSize( wx.Size( 200,-1 ) ) bSizer1.Add( self.tre_plugins, 0, wx.ALL|wx.EXPAND, 5 ) bSizer3 = wx.BoxSizer( wx.VERTICAL ) bSizer4 = wx.BoxSizer( wx.HORIZONTAL ) self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, "Plugin Infomation:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText2.Wrap( -1 ) bSizer4.Add( self.m_staticText2, 0, wx.ALL, 5 ) self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, "[SourceCode]", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText3.Wrap( -1 ) self.m_staticText3.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_HIGHLIGHT ) ) bSizer4.Add( self.m_staticText3, 0, wx.ALL, 5 ) bSizer3.Add( bSizer4, 0, wx.EXPAND, 5 ) self.txt_info = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE ) bSizer3.Add( self.txt_info, 1, wx.ALL|wx.EXPAND, 5 ) bSizer1.Add( bSizer3, 1, wx.EXPAND, 5 ) self.SetSizer( bSizer1 ) self.Layout() self.Centre( wx.BOTH ) # Connect Events self.tre_plugins.Bind( wx.EVT_TREE_ITEM_ACTIVATED, self.on_run ) self.tre_plugins.Bind( wx.EVT_TREE_SEL_CHANGED, self.on_select ) self.m_staticText3.Bind( wx.EVT_LEFT_DOWN, self.on_source ) self.plg = None self.load()
def __init__( self, parent ): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = "Tools Tree", pos = wx.DefaultPosition, size = wx.Size( 452,300 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) logopath = os.path.join(root_dir, 'data/logo.ico') self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DLIGHT ) ) self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO)) self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) bSizer1 = wx.BoxSizer( wx.HORIZONTAL ) self.tre_plugins = wx.TreeCtrl( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TR_DEFAULT_STYLE ) self.tre_plugins.SetMinSize( wx.Size( 200,-1 ) ) bSizer1.Add( self.tre_plugins, 0, wx.ALL|wx.EXPAND, 5 ) bSizer3 = wx.BoxSizer( wx.VERTICAL ) bSizer4 = wx.BoxSizer( wx.HORIZONTAL ) self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, "Tool Infomation:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText2.Wrap( -1 ) bSizer4.Add( self.m_staticText2, 0, wx.ALL, 5 ) self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, "[SourceCode]", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText3.Wrap( -1 ) self.m_staticText3.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_HIGHLIGHT ) ) bSizer4.Add( self.m_staticText3, 0, wx.ALL, 5 ) bSizer3.Add( bSizer4, 0, wx.EXPAND, 5 ) self.txt_info = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE ) bSizer3.Add( self.txt_info, 1, wx.ALL|wx.EXPAND, 5 ) bSizer1.Add( bSizer3, 1, wx.EXPAND, 5 ) self.SetSizer( bSizer1 ) self.Layout() self.Centre( wx.BOTH ) # Connect Events self.tre_plugins.Bind( wx.EVT_TREE_ITEM_ACTIVATED, self.on_run ) self.tre_plugins.Bind( wx.EVT_TREE_SEL_CHANGED, self.on_select ) self.m_staticText3.Bind( wx.EVT_LEFT_DOWN, self.on_source ) self.plg = None self.load()
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"Selection Frame", pos=wx.DefaultPosition, size=wx.Size(500, 300), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.model = WatchableDict() self.model["selection"] = 1 self.model["list"] = [u"One", u"Two", u"Three"] self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) sizer = wx.BoxSizer(wx.VERTICAL) gb_sizer = wx.GridBagSizer(5, 5) gb_sizer.SetFlexibleDirection(wx.BOTH) gb_sizer.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) choices = [] self.combo_box = wx.ComboBox(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, choices, 0) gb_sizer.Add(self.combo_box, wx.GBPosition(0, 0), wx.GBSpan(1, 1), wx.EXPAND, 5) pywatch.wx.ItemContainerItemWatcher(self.combo_box, self.model, "list") pywatch.wx.SelectionChanger(self.combo_box, self.model, "selection") self.choice = wx.Choice(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choices, 0) self.choice.SetSelection(0) gb_sizer.Add(self.choice, wx.GBPosition(1, 0), wx.GBSpan(1, 1), wx.EXPAND, 5) pywatch.wx.ItemContainerItemWatcher(self.choice, self.model, "list") pywatch.wx.SelectionChanger(self.choice, self.model, "selection") self.list_box = wx.ListBox(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choices, 0) gb_sizer.Add(self.list_box, wx.GBPosition(2, 0), wx.GBSpan(1, 1), wx.EXPAND, 5) pywatch.wx.ItemContainerItemWatcher(self.list_box, self.model, "list") pywatch.wx.SelectionChanger(self.list_box, self.model, "selection") self.radio_box = wx.RadioBox(self, wx.ID_ANY, u"Radio Box", wx.DefaultPosition, wx.DefaultSize, [u"One", u"Two", u"Three"], 1, wx.RA_SPECIFY_COLS) self.radio_box.SetSelection(0) gb_sizer.Add(self.radio_box, wx.GBPosition(3, 0), wx.GBSpan(1, 1), wx.EXPAND, 5) pywatch.wx.SelectionChanger(self.radio_box, self.model, "selection") gb_sizer.AddGrowableCol(0) gb_sizer.AddGrowableRow(2) sizer.Add(gb_sizer, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(sizer) self.Layout() self.Centre(wx.BOTH)
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"List Editor", pos=wx.DefaultPosition, size=wx.Size(500, 300), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) sizer = wx.BoxSizer(wx.VERTICAL) gb_sizer = wx.GridBagSizer(5, 5) gb_sizer.SetFlexibleDirection(wx.BOTH) gb_sizer.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) list_boxChoices = [] self.list_box = wx.ListBox(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, list_boxChoices, 0) gb_sizer.Add(self.list_box, wx.GBPosition(0, 0), wx.GBSpan(1, 2), wx.EXPAND, 0) self.add_button = wx.Button(self, wx.ID_ANY, u"Add", wx.DefaultPosition, wx.DefaultSize, 0) gb_sizer.Add(self.add_button, wx.GBPosition(1, 0), wx.GBSpan(1, 1), wx.EXPAND, 0) self.remove_button = wx.Button(self, wx.ID_ANY, u"Remove", wx.DefaultPosition, wx.DefaultSize, 0) gb_sizer.Add(self.remove_button, wx.GBPosition(1, 1), wx.GBSpan(1, 1), wx.EXPAND, 0) self.text_ctrl = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) gb_sizer.Add(self.text_ctrl, wx.GBPosition(2, 0), wx.GBSpan(1, 2), wx.EXPAND, 0) gb_sizer.AddGrowableCol(0) gb_sizer.AddGrowableCol(1) gb_sizer.AddGrowableRow(0) sizer.Add(gb_sizer, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(sizer) self.Layout() self.Centre(wx.BOTH) self.add_button.Bind(wx.EVT_BUTTON, self.on_add) self.remove_button.Bind(wx.EVT_BUTTON, self.on_remove) self.model = WatchableDict() self.model["list"] = ["one", "two", "three", "four"] self.model["selection"] = 0 pywatch.wx.ItemContainerItemWatcher(self.list_box, self.model, "list") pywatch.wx.SelectionChanger(self.list_box, self.model, "selection") def getter(): return self.model["list"][self.model["selection"]] def setter(value): self.model["list"][self.model["selection"]] = value pywatch.wx.ValueChanger(self.text_ctrl, self.model, ("list", "selection", setter, getter))
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"List Frame", pos=wx.DefaultPosition, size=wx.Size(500, 300), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) sizer = wx.BoxSizer(wx.VERTICAL) gb_sizer = wx.GridBagSizer(5, 5) gb_sizer.SetFlexibleDirection(wx.BOTH) gb_sizer.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) list_boxChoices = [] self.list_box = wx.ListBox(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, list_boxChoices, 0) gb_sizer.Add(self.list_box, wx.GBPosition(0, 0), wx.GBSpan(1, 2), wx.EXPAND, 0) combo_boxChoices = [] self.combo_box = wx.ComboBox(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, combo_boxChoices, 0) gb_sizer.Add(self.combo_box, wx.GBPosition(1, 0), wx.GBSpan(1, 2), wx.EXPAND, 0) choiceChoices = [] self.choice = wx.Choice(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choiceChoices, 0) self.choice.SetSelection(0) gb_sizer.Add(self.choice, wx.GBPosition(2, 0), wx.GBSpan(1, 2), wx.EXPAND, 0) self.text_ctrl = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_PROCESS_ENTER) gb_sizer.Add(self.text_ctrl, wx.GBPosition(3, 0), wx.GBSpan(1, 1), wx.EXPAND, 0) self.button = wx.Button(self, wx.ID_ANY, u"Add", wx.DefaultPosition, wx.DefaultSize, 0) gb_sizer.Add(self.button, wx.GBPosition(3, 1), wx.GBSpan(1, 1), wx.ALL, 0) gb_sizer.AddGrowableCol(0) gb_sizer.AddGrowableRow(0) sizer.Add(gb_sizer, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(sizer) self.Layout() self.Centre(wx.BOTH) # Connect Events self.button.Bind(wx.EVT_BUTTON, self.on_add) self.text_ctrl.Bind(wx.EVT_TEXT_ENTER, self.on_add) self.model = WatchableDict() self.model["list"] = [] self.model["text"] = "" pywatch.wx.ValueChanger(self.text_ctrl, self.model, "text") pywatch.wx.ItemContainerItemWatcher(self.list_box, self.model, "list") pywatch.wx.ItemContainerItemWatcher(self.choice, self.model, "list") pywatch.wx.ItemContainerItemWatcher(self.combo_box, self.model, "list") # Virtual event handlers, overide them in your derived class
def __init__(self, parent): wx.Frame.__init__(self, parent, title=u"Addition Frame") self.model = WatchableDict() self.model["a"] = 2 self.model["b"] = 3 self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) sizer = wx.BoxSizer(wx.VERTICAL) gb_sizer = wx.GridBagSizer(5, 5) gb_sizer.SetFlexibleDirection(wx.BOTH) gb_sizer.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.spin_ctrl_a = wx.SpinCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 10, 0) gb_sizer.Add(self.spin_ctrl_a, wx.GBPosition(0, 0), wx.GBSpan(1, 1), wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5) pywatch.wx.ValueChanger(self.spin_ctrl_a, self.model, "a") self.static_text = wx.StaticText(self, wx.ID_ANY, u"+", wx.DefaultPosition, wx.DefaultSize, 0) self.static_text.Wrap(-1) gb_sizer.Add(self.static_text, wx.GBPosition(0, 1), wx.GBSpan(1, 1), wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5) self.spin_ctrl_b = wx.SpinCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 10, 0) gb_sizer.Add(self.spin_ctrl_b, wx.GBPosition(0, 2), wx.GBSpan(1, 1), wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0) pywatch.wx.ValueChanger(self.spin_ctrl_b, self.model, "b") self.static_text_out = wx.StaticText(self, wx.ID_ANY, u"{}", wx.DefaultPosition, wx.DefaultSize, 0) self.static_text_out.Wrap(-1) gb_sizer.Add(self.static_text_out, wx.GBPosition(1, 0), wx.GBSpan(1, 3), wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5) pywatch.wx.LabelWatcher(self.static_text_out, self.model, ("a", "b", lambda: self.model["a"] + self.model["b"])) self.gauge = wx.Gauge(self, wx.ID_ANY, 20, wx.DefaultPosition, wx.DefaultSize, wx.GA_HORIZONTAL) self.gauge.SetValue(0) gb_sizer.Add(self.gauge, wx.GBPosition(2, 0), wx.GBSpan(1, 3), wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 0) pywatch.wx.ValueWatcher(self.gauge, self.model, ("a", "b", lambda: self.model["a"] + self.model["b"])) gb_sizer.AddGrowableCol(0) gb_sizer.AddGrowableCol(2) sizer.Add(gb_sizer, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(sizer) self.Layout() self.Centre(wx.BOTH)