我们从Python开源项目中,提取了以下40个代码示例,用于说明如何使用wx.ALIGN_CENTER_VERTICAL。
def __init__(self, parent, id, title, message, download_url, size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE, name='dialog'): wx.Dialog.__init__(self, parent, id, title, pos, size, style, name) label = wx.StaticText(self, label=message) button = wx.Button(self, id=wx.ID_OK, label="Close") button.SetDefault() line = wx.StaticLine(self, wx.ID_ANY, size=(20, -1), style=wx.LI_HORIZONTAL) download_ctrl = hl.HyperLinkCtrl(self, wx.ID_ANY, download_url, URL=download_url) sizer = wx.BoxSizer(wx.VERTICAL) button_sizer = wx.StdDialogButtonSizer() button_sizer.AddButton(button) button_sizer.Realize() sizer.Add(label, 0, wx.ALIGN_CENTER|wx.ALL, 5) sizer.Add(download_ctrl, 0, wx.ALL, 10) sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP, 5) sizer.Add(button_sizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) self.SetSizer(sizer) sizer.Fit(self)
def __init__(self, parent=None, default_url=""): wx.Panel.__init__(self, parent) self._sizer = wx.BoxSizer(wx.HORIZONTAL) self._url = wx.TextCtrl(self) self._url.Bind(wx.EVT_KILL_FOCUS, self._field_changed) self._url.SetValue(default_url) self._status_label = ProcessingPlaceholderText(self) label = wx.StaticText(self, label="Server URL") label.SetToolTipString("URL for the IRIDA server API.") self._sizer.Add(label, flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, border=5, proportion=0) self._sizer.Add(self._url, flag=wx.EXPAND, proportion=1) self._sizer.Add(self._status_label, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, border=5, proportion=0) self.SetSizerAndFit(self._sizer) self.Layout() self.Bind(wx.EVT_CLOSE, self._on_close) pub.subscribe(self._status_label.SetError, APIConnectorTopics.connection_error_url_topic) pub.subscribe(self._status_label.SetSuccess, APIConnectorTopics.connection_success_topic) pub.subscribe(self._status_label.SetSuccess, APIConnectorTopics.connection_success_valid_url)
def initOptions(self): STransConfigPanel.initOptions(self) optionsSizer = wx.BoxSizer(wx.HORIZONTAL) kurtosisControlBox = widgets.ControlBox(self, label='Kurtosis', orient=wx.VERTICAL) self.kurtosisComboBox = wx.ComboBox(self, choices=('Adapt', 'Sub', 'Super'), value=self.flt.kurtosis, style=wx.CB_DROPDOWN) self.Bind(wx.EVT_COMBOBOX, self.setKurtosis, self.kurtosisComboBox) kurtosisControlBox.Add(self.kurtosisComboBox, proportion=1, flag=wx.ALL, border=8) optionsSizer.Add(kurtosisControlBox, proportion=1, flag=wx.LEFT | wx.RIGHT, border=8) maxIterControlBox = widgets.ControlBox(self, label='Max Iter.', orient=wx.HORIZONTAL) self.maxIterSpinCtrl = wx.SpinCtrl(self, value=str(self.flt.maxIter), min=50, max=3500) self.Bind(wx.EVT_SPINCTRL, self.setMaxIter, self.maxIterSpinCtrl) maxIterControlBox.Add(self.maxIterSpinCtrl, proportion=1, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL, border=8) optionsSizer.Add(maxIterControlBox, proportion=0, flag=wx.RIGHT | wx.EXPAND, border=8) #lrControlBox = widgets.ControlBox(self, label='Learning Rate.', orient=wx.HORIZONTAL) self.sizer.Add(optionsSizer, proportion=0)
def __do_layout(self): # begin wxGlade: MyFrame.__do_layout sizer_4 = wx.BoxSizer(wx.VERTICAL) sizer_5 = wx.BoxSizer(wx.HORIZONTAL) sizer_5.Add(self.label_5, 0, wx.ALIGN_CENTER_VERTICAL, 0) sizer_5.Add(self.text_ctrl_bucar, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 7) sizer_5.Add(self.button_buscar, 0, wx.ALIGN_CENTER_VERTICAL, 0) sizer_5.Add(self.label_6, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) sizer_5.Add(self.bitmap_button_1, 0, wx.ALIGN_CENTER_VERTICAL, 0) sizer_4.Add(sizer_5, 1, wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT | wx.ALL, 6) sizer_4.Add(self.list_ctrl_1, 1, 0, 0) self.SetSizer(sizer_4) sizer_4.Fit(self) self.Layout() # end wxGlade # end of class MyFrame
def __init__(self,parent,slidername,**kwargs): wx.Panel.__init__(self,parent,**kwargs) sliderlabel = wx.StaticText(self,-1,label=slidername+':',size=(50,-1)) self.slidertext = wx.TextCtrl(self,-1,style=wx.TE_PROCESS_ENTER, size=(50,-1)) self.slider = JumpSlider(self) #self.slider = wx.Slider(self) spintext = wx.StaticText(self,-1,label=u"\u00B1",size=(10,-1)) self.spin = wx.SpinCtrl(self,value='0',initial=0,size=(50,-1)) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(sliderlabel,0,wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 10) hbox.Add(self.slidertext,0,wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 10) hbox.Add(self.slider,1,wx.EXPAND,0) hbox.Add(spintext,0,wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 10) hbox.Add(self.spin,0,wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 10) vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(hbox,1,wx.EXPAND,0) self.SetSizer(vbox) self.SetValue(0)
def GetBitmapRect(self): client_size = self.GetClientSize() bitmap_size = self.BackgroundBitmap.GetSize() if self.BackgroundAlign & wx.ALIGN_RIGHT: x = client_size[0] - bitmap_size[0] elif self.BackgroundAlign & wx.ALIGN_CENTER_HORIZONTAL: x = (client_size[0] - bitmap_size[0]) / 2 else: x = 0 if self.BackgroundAlign & wx.ALIGN_BOTTOM: y = client_size[1] - bitmap_size[1] elif self.BackgroundAlign & wx.ALIGN_CENTER_VERTICAL: y = (client_size[1] - bitmap_size[1]) / 2 else: y = 0 return wx.Rect(x, y, bitmap_size[0], bitmap_size[1])
def __do_layout(self): # begin wxGlade: ui_choice2Dialog.__do_layout sizer_1 = wx.BoxSizer(wx.HORIZONTAL) sizer_3 = wx.BoxSizer(wx.VERTICAL) sizer_2 = wx.BoxSizer(wx.VERTICAL) sizer_2.Add(self.numListBox, 1, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 20) sizer_2.Add(self.button_ok, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 10) sizer_1.Add(sizer_2, 1, wx.EXPAND, 0) sizer_3.Add(self.denListBox, 1, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 20) sizer_3.Add(self.button_cancel, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 10) sizer_1.Add(sizer_3, 1, wx.EXPAND, 0) self.SetSizer(sizer_1) self.Layout() # end wxGlade # end of class ui_choice2Dialog #if __name__ == "__main__": #app = wx.PySimpleApp(0) #wx.InitAllImageHandlers() #ChiantiPy = ui_choice2Dialog(None, -1, "") #app.SetTopWindow(ChiantiPy) #ChiantiPy.Show() #app.MainLoop()
def __do_layout(self): # begin wxGlade: Login.__do_layout sizer_1 = wx.BoxSizer(wx.VERTICAL) grid_sizer_1 = wx.GridSizer(3, 2, 0, 0) grid_sizer_1.Add(self.label_1, 0, wx.LEFT, 20) grid_sizer_1.Add(self.combo_box_1, 0, 0, 0) grid_sizer_1.Add(self.label_2, 0, wx.LEFT, 20) grid_sizer_1.Add(self.text_ctrl_1, 0, 0, 0) grid_sizer_1.Add(self.button_1, 0, wx.LEFT | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 50) grid_sizer_1.Add(self.button_2, 0, wx.RIGHT | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 50) sizer_1.Add(grid_sizer_1, 1, wx.TOP | wx.EXPAND, 50) self.SetSizer(sizer_1) self.Layout() self.Centre() # end wxGlade
def __do_layout(self): sizer_1 = wx.BoxSizer(wx.HORIZONTAL) sizer_2 = wx.BoxSizer(wx.VERTICAL) sizer_4 = wx.BoxSizer(wx.VERTICAL) grid_sizer_3 = wx.GridSizer(1, 2, 20, 20) sizer_3 = wx.BoxSizer(wx.HORIZONTAL) grid_sizer_1 = wx.GridSizer(3, 1, 0, 0) grid_sizer_2 = wx.GridSizer(3, 1, 0, 0) grid_sizer_2.Add(self.label_installed_version, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_2.Add(self.label_latest_version, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_2.Add(self.label_is_update, 0, wx.ALIGN_CENTER_VERTICAL, 0) sizer_3.Add(grid_sizer_2, 1, wx.EXPAND, 0) grid_sizer_1.Add(self.progress_bar, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_1.Add(self.animation_panel, 1, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_1.Add(self.label_status, 0, wx.ALIGN_CENTER_VERTICAL, 0) sizer_3.Add(grid_sizer_1, 1, wx.EXPAND, 0) sizer_2.Add(sizer_3, 3, wx.EXPAND, 0) grid_sizer_3.Add(self.button_close, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_3.Add(self.button_install, 0, wx.ALIGN_CENTER_VERTICAL, 0) sizer_4.Add(grid_sizer_3, 1, wx.EXPAND, 0) sizer_2.Add(sizer_4, 2, wx.EXPAND, 0) sizer_1.Add(sizer_2, 1, wx.ALL | wx.EXPAND, 10) self.SetSizer(sizer_1) self.Layout() # end wxGlade
def __do_layout(self): # begin wxGlade: add_academic_year.__do_layout sizer_1 = wx.BoxSizer(wx.HORIZONTAL) sizer_2 = wx.BoxSizer(wx.VERTICAL) grid_sizer_1 = wx.GridSizer(2, 1, 10, 10) sizer_4 = wx.BoxSizer(wx.VERTICAL) sizer_5 = wx.BoxSizer(wx.HORIZONTAL) sizer_3 = wx.BoxSizer(wx.HORIZONTAL) sizer_3.Add(self.label_3, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 0) sizer_3.Add(self.text_ctrl_1, 0, wx.ALIGN_CENTER_VERTICAL, 0) sizer_3.Add(self.label_4, 0, wx.ALIGN_CENTER_VERTICAL, 0) sizer_3.Add(self.text_ctrl_2, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_1.Add(sizer_3, 1, wx.EXPAND, 0) sizer_5.Add(self.button_close, 0, wx.RIGHT, 20) sizer_5.Add(self.button_add, 0, wx.LEFT, 20) sizer_4.Add(sizer_5, 1, wx.ALIGN_CENTER_VERTICAL, 10) grid_sizer_1.Add(sizer_4, 1, wx.TOP | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 30) sizer_2.Add(grid_sizer_1, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 0) sizer_1.Add(sizer_2, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 0) self.SetSizer(sizer_1) self.Layout() # end wxGlade
def __init__(self, parent, frame, ID, label): wx.Panel.__init__(self, parent, ID) self.frame = frame box = wx.StaticBox(self, -1, label) sizer = wx.StaticBoxSizer(box, wx.VERTICAL) self.next_button = wx.Button(self, -1, label="Next 100") self.next_button.Bind(wx.EVT_BUTTON, self.on_next) self.previous_button = wx.Button(self, -1, label="Previous 100") self.previous_button.Bind(wx.EVT_BUTTON, self.on_previous) manual_box = wx.BoxSizer(wx.HORIZONTAL) manual_box.Add(self.previous_button, flag=wx.ALIGN_CENTER_VERTICAL) manual_box.AddSpacer(10) manual_box.Add(self.next_button, flag=wx.ALIGN_CENTER_VERTICAL) sizer.Add(manual_box, 0, wx.ALL, 10) self.SetSizer(sizer) sizer.Fit(self)
def __init__(self, parent): super(MyTitle, self).__init__(parent) self.SetBackgroundColour('#00b294') self.SetMinSize((-1, 80)) sizer = wx.BoxSizer() sizer.AddStretchSpacer() family = wx.FONTFAMILY_DEFAULT style = wx.FONTSTYLE_NORMAL weight = wx.FONTWEIGHT_NORMAL font = wx.Font(20, family, style, weight) self.text = wx.StaticText(self, label=TITLE, style=wx.ALIGN_CENTER) self.text.SetFont(font) sizer.Add(self.text, flag=wx.ALIGN_CENTER_VERTICAL) sizer.AddStretchSpacer() self.SetSizer(sizer)
def __init__(self, parent=None, default_post_process=""): wx.Panel.__init__(self, parent) self._sizer = wx.BoxSizer(wx.HORIZONTAL) task_label = wx.StaticText(self, label="Task to run on successful upload") task_label.SetToolTipString("Post-processing job to run after a run has been successfully uploaded to IRIDA.") self._sizer.Add(task_label, flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, border=5, proportion=0) task = wx.TextCtrl(self) task.Bind(wx.EVT_KILL_FOCUS, lambda evt: send_message(SettingsDialog.field_changed_topic, field_name="completion_cmd", field_value=task.GetValue())) task.SetValue(default_post_process) self._sizer.Add(task, flag=wx.EXPAND, proportion=1) self.SetSizerAndFit(self._sizer) self.Layout()
def __init__(self,parent,fdir,**kwargs): wx.Panel.__init__(self,parent,**kwargs) self.fdir = fdir statictxt = wx.StaticText(self,-1,label='File directory: ') self.textctrl = wx.TextCtrl(self,-1,self.fdir,style=wx.TE_PROCESS_ENTER) self.changebutton = wx.Button(self,-1,"...") hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(statictxt,0,wx.ALIGN_CENTER_VERTICAL| wx.LEFT,5) hbox.Add(self.textctrl,1,wx.EXPAND,0) hbox.Add(self.changebutton,0,wx.EXPAND) self.SetSizer(hbox)
def __init__(self, parent): wx.Dialog.__init__(self, parent, title=_('Create a new action')) main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10) main_sizer.AddGrowableCol(0) main_sizer.AddGrowableRow(0) infos_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=3, vgap=15) infos_sizer.AddGrowableCol(1) main_sizer.AddSizer(infos_sizer, border=20, flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT) actionname_label = wx.StaticText(self, label=_('Action Name:')) infos_sizer.AddWindow(actionname_label, border=4, flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP) self.ActionName = wx.TextCtrl(self, size=wx.Size(180, -1)) infos_sizer.AddWindow(self.ActionName, flag=wx.GROW) language_label = wx.StaticText(self, label=_('Language:')) infos_sizer.AddWindow(language_label, border=4, flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP) self.Language = wx.ComboBox(self, style=wx.CB_READONLY) infos_sizer.AddWindow(self.Language, flag=wx.GROW) button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE) self.Bind(wx.EVT_BUTTON, self.OnOK, button_sizer.GetAffirmativeButton()) main_sizer.AddSizer(button_sizer, border=20, flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT) self.SetSizer(main_sizer) for option in GetActionLanguages(): self.Language.Append(_(option)) self.Fit() self.PouNames = [] self.PouElementNames = []
def __init__(self, parent): wx.Dialog.__init__(self, parent, title=_('Create a new transition')) main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10) main_sizer.AddGrowableCol(0) main_sizer.AddGrowableRow(0) infos_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=3, vgap=10) infos_sizer.AddGrowableCol(1) main_sizer.AddSizer(infos_sizer, border=20, flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT) transitionname_label = wx.StaticText(self, label=_('Transition Name:')) infos_sizer.AddWindow(transitionname_label, border=4, flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP) self.TransitionName = wx.TextCtrl(self, size=wx.Size(180, -1)) infos_sizer.AddWindow(self.TransitionName, flag=wx.GROW) language_label = wx.StaticText(self, label=_('Language:')) infos_sizer.AddWindow(language_label, border=4, flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP) self.Language = wx.ComboBox(self, style=wx.CB_READONLY) infos_sizer.AddWindow(self.Language, flag=wx.GROW) button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE) self.Bind(wx.EVT_BUTTON, self.OnOK, button_sizer.GetAffirmativeButton()) main_sizer.AddSizer(button_sizer, border=20, flag=wx.ALIGN_RIGHT | wx.BOTTOM) self.SetSizer(main_sizer) for language in GetTransitionLanguages(): self.Language.Append(_(language)) self.Fit() self.PouNames = [] self.PouElementNames = []
def _init_coll_HeaderSizer_Items(self, parent): parent.AddWindow(self.HeaderLabel, 1, border=5, flag=wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER_VERTICAL) parent.AddWindow(self.ResetButton, 0, border=0, flag=0)
def __do_layout(self): # begin wxGlade: secret_win.__do_layout sizer_1 = wx.BoxSizer(wx.VERTICAL) sizer_2 = wx.BoxSizer(wx.VERTICAL) sizer_5 = wx.BoxSizer(wx.VERTICAL) sizer_4 = wx.BoxSizer(wx.HORIZONTAL) sizer_9 = wx.BoxSizer(wx.VERTICAL) sizer_8 = wx.BoxSizer(wx.VERTICAL) sizer_3 = wx.BoxSizer(wx.HORIZONTAL) sizer_7 = wx.BoxSizer(wx.VERTICAL) sizer_6 = wx.BoxSizer(wx.VERTICAL) sizer_6.Add(self.label_1, 0, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_3.Add(sizer_6, 1, wx.EXPAND, 10) sizer_7.Add(self.text_ctrl_1, 0, 0, 0) sizer_3.Add(sizer_7, 1, wx.EXPAND, 0) sizer_2.Add(sizer_3, 1, wx.ALL | wx.EXPAND, 10) sizer_8.Add(self.label_2, 0, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_4.Add(sizer_8, 1, wx.EXPAND, 0) sizer_9.Add(self.text_ctrl_2, 0, 0, 0) sizer_4.Add(sizer_9, 1, wx.EXPAND, 0) sizer_2.Add(sizer_4, 1, wx.EXPAND, 0) sizer_5.Add(self.button_1, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 0) sizer_2.Add(sizer_5, 1, wx.EXPAND, 0) sizer_1.Add(sizer_2, 1, wx.EXPAND, 0) self.SetSizer(sizer_1) self.Layout() self.Center() # end wxGlade
def __do_layout(self): # begin wxGlade: sampoorna_win.__do_layout sizer_1 = wx.BoxSizer(wx.VERTICAL) sizer_2 = wx.BoxSizer(wx.VERTICAL) sizer_5 = wx.BoxSizer(wx.VERTICAL) grid_sizer_2 = wx.GridSizer(1, 3, 0, 0) sizer_4 = wx.BoxSizer(wx.VERTICAL) grid_sizer_1 = wx.GridSizer(2, 2, 0, 0) sizer_3 = wx.BoxSizer(wx.VERTICAL) sizer_3.Add(self.label_1, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 0) self.panel_warning.SetSizer(sizer_3) sizer_2.Add(self.panel_warning, 1, wx.EXPAND, 0) sizer_4.Add(self.bitmap_1, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_1.Add(self.label_2, 0, 0, 0) grid_sizer_1.Add(self.text_ctrl_1, 0, 0, 0) grid_sizer_1.Add(self.label_3, 0, 0, 0) grid_sizer_1.Add(self.text_ctrl_2, 0, 0, 0) sizer_4.Add(grid_sizer_1, 1, wx.EXPAND, 0) sizer_4.Add(self.button_1, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_HORIZONTAL, 0) self.panel_login.SetSizer(sizer_4) sizer_2.Add(self.panel_login, 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_2.Add(self.checkbox_1, 0, 0, 0) grid_sizer_2.Add(self.checkbox_2, 0, 0, 0) grid_sizer_2.Add(self.checkbox_3, 0, 0, 0) sizer_5.Add(grid_sizer_2, 1, wx.EXPAND, 0) sizer_5.Add(self.button_2, 0, 0, 0) self.panel_class.SetSizer(sizer_5) sizer_2.Add(self.panel_class, 1, wx.EXPAND, 0) sizer_2.Add(self.panel_progress, 1, wx.EXPAND, 0) sizer_2.Add(self.panel_report, 1, wx.EXPAND, 0) self.panel_1.SetSizer(sizer_2) sizer_1.Add(self.panel_1, 1, wx.EXPAND, 0) self.SetSizer(sizer_1) sizer_1.Fit(self) self.Layout() # end wxGlade
def __do_layout(self): # begin wxGlade: delete.__do_layout sizer_3 = wx.BoxSizer(wx.VERTICAL) sizer_2 = wx.BoxSizer(wx.VERTICAL) sizer_6 = wx.BoxSizer(wx.HORIZONTAL) sizer_1 = wx.BoxSizer(wx.VERTICAL) sizer_7 = wx.BoxSizer(wx.HORIZONTAL) sizer_8 = wx.BoxSizer(wx.VERTICAL) sizer_5 = wx.BoxSizer(wx.VERTICAL) sizer_12 = wx.BoxSizer(wx.HORIZONTAL) sizer_14 = wx.BoxSizer(wx.VERTICAL) sizer_13 = wx.BoxSizer(wx.VERTICAL) sizer_15 = wx.BoxSizer(wx.VERTICAL) sizer_16 = wx.BoxSizer(wx.VERTICAL) sizer_16.Add(self.label_1, 0, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_5.Add(sizer_16, 1, wx.EXPAND, 0) sizer_15.Add(self.combo_box_1, 0, wx.TOP | wx.ALIGN_CENTER_HORIZONTAL, 20) sizer_5.Add(sizer_15, 1, wx.EXPAND, 0) sizer_13.Add(self.combo_box_2, 0, wx.TOP | wx.ALIGN_CENTER_HORIZONTAL, 10) sizer_5.Add(sizer_13, 1, wx.EXPAND, 0) sizer_14.Add(self.combo_box_3, 0, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_12.Add(sizer_14, 1, wx.EXPAND, 0) sizer_5.Add(sizer_12, 1, wx.EXPAND, 0) sizer_2.Add(sizer_5, 0, wx.EXPAND, 0) sizer_2.Add(self.static_line_2, 0, wx.EXPAND, 0) sizer_8.Add(self.check_list_box_1, 0, wx.EXPAND, 0) sizer_8.Add(self.check_list_box_2, 1, wx.EXPAND, 0) sizer_7.Add(sizer_8, 1, wx.EXPAND, 0) self.panel_1.SetSizer(sizer_7) sizer_1.Add(self.panel_1, 1, wx.EXPAND, 0) sizer_2.Add(sizer_1, 1, wx.EXPAND, 0) sizer_6.Add(self.button_close, 0, wx.LEFT, 50) sizer_6.Add(self.button_proceed, 0, wx.LEFT, 50) #sizer_2.Add(sizer_6, 0, wx.EXPAND, 0) sizer_2.Add(sizer_6, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 0) self.panel_2.SetSizer(sizer_2) sizer_3.Add(self.panel_2, 1, wx.ALL | wx.EXPAND, 20) self.SetSizer(sizer_3) self.Layout() self.Centre() # end wxGlade
def __do_layout(self): # begin wxGlade: institution.__do_layout sizer_1 = wx.BoxSizer(wx.VERTICAL) sizer_2 = wx.BoxSizer(wx.HORIZONTAL) sizer_3 = wx.BoxSizer(wx.VERTICAL) sizer_6 = wx.BoxSizer(wx.HORIZONTAL) sizer_8 = wx.BoxSizer(wx.HORIZONTAL) sizer_7 = wx.BoxSizer(wx.VERTICAL) grid_sizer_1 = wx.GridSizer(5, 2, 0, 0) sizer_4 = wx.BoxSizer(wx.HORIZONTAL) sizer_5 = wx.BoxSizer(wx.VERTICAL) sizer_5.Add(self.label_1, 0, 0, 0) sizer_4.Add(sizer_5, 1, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_3.Add(sizer_4, 1, wx.ALIGN_CENTER_HORIZONTAL, 0) grid_sizer_1.Add(self.label_2, 0, 0, 0) grid_sizer_1.Add(self.text_ctrl_name, 0, 0, 0) grid_sizer_1.Add(self.label_3, 0, 0, 0) grid_sizer_1.Add(self.text_ctrl_code, 0, 0, 0) grid_sizer_1.Add(self.label_4, 0, 0, 0) grid_sizer_1.Add(self.text_ctrl_email, 0, 0, 0) grid_sizer_1.Add(self.label_5, 0, 0, 0) grid_sizer_1.Add(self.text_ctrl_phone, 0, 0, 0) grid_sizer_1.Add(self.label_6, 0, 0, 0) grid_sizer_1.Add(self.text_ctrl_deo, 0, 0, 0) sizer_3.Add(grid_sizer_1, 1, wx.BOTTOM | wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 50) sizer_7.Add(self.button_cancel, 0, wx.ALIGN_RIGHT, 0) sizer_6.Add(sizer_7, 1, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 50) sizer_8.Add(self.button_save, 0, wx.ALIGN_CENTER_VERTICAL, 0) sizer_6.Add(sizer_8, 1, wx.LEFT | wx.EXPAND, 50) sizer_3.Add(sizer_6, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 0) sizer_2.Add(sizer_3, 1, wx.ALL | wx.EXPAND, 40) sizer_1.Add(sizer_2, 30, wx.ALL | wx.EXPAND, 0) self.SetSizer(sizer_1) self.Layout() # end wxGlade
def __do_layout(self): # begin wxGlade: MyDialog.__do_layout sizer_1 = wx.BoxSizer(wx.HORIZONTAL) sizer_2 = wx.BoxSizer(wx.VERTICAL) grid_sizer_1 = wx.GridSizer(2, 1, 40, 40) sizer_3 = wx.BoxSizer(wx.HORIZONTAL) grid_sizer_1.Add(self.text_ctrl_passwd, 0, 0, 0) sizer_3.Add(self.button_cancel, 0, wx.RIGHT | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 50) sizer_3.Add(self.button_ok, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_1.Add(sizer_3, 1, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_2.Add(grid_sizer_1, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 0) sizer_1.Add(sizer_2, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 0) self.SetSizer(sizer_1) self.Layout() # end wxGlade
def __init__(self, parent, ID): wx.Panel.__init__(self, parent, ID) box = wx.StaticBox(self, -1, "relabelling key") sizer = wx.StaticBoxSizer(box, wx.VERTICAL) self.real = wx.StaticText(self, label="REAL") self.real.SetBackgroundColour(wx.WHITE) self.real.SetForegroundColour("#3366FF") self.bogus = wx.StaticText(self, label="BOGUS") self.bogus.SetBackgroundColour(wx.WHITE) self.bogus.SetForegroundColour("#FF0066") self.ghost = wx.StaticText(self, label="GHOST") self.ghost.SetBackgroundColour(wx.WHITE) self.ghost.SetForegroundColour("#9933FF") manual_box = wx.BoxSizer(wx.HORIZONTAL) manual_box.Add(self.real, flag=wx.ALIGN_CENTER_VERTICAL) manual_box.Add(self.bogus, flag=wx.ALIGN_CENTER_VERTICAL) manual_box.Add(self.ghost, flag=wx.ALIGN_CENTER_VERTICAL) sizer.Add(manual_box, 0, wx.ALL, 10) self.SetSizer(sizer) sizer.Fit(self)
def __init__(self, parent, frame, ID): wx.Panel.__init__(self, parent, ID) self.frame = frame box = wx.StaticBox(self, -1, "data set control") sizer = wx.StaticBoxSizer(box, wx.VERTICAL) """ self.fp_button = wx.Button(self, -1, label="FP") self.fp_button.Bind(wx.EVT_BUTTON, self.on_fp) self.tp_button = wx.Button(self, -1, label="TP") self.tp_button.Bind(wx.EVT_BUTTON, self.on_tp) self.fn_button = wx.Button(self, -1, label="FN") self.fn_button.Bind(wx.EVT_BUTTON, self.on_fn) self.tn_button = wx.Button(self, -1, label="TN") self.tn_button.Bind(wx.EVT_BUTTON, self.on_tn) """ self.real_button = wx.Button(self, -1, label="Real") self.real_button.Bind(wx.EVT_BUTTON, self.on_real) self.bogus_button = wx.Button(self, -1, label="Bogus") self.bogus_button.Bind(wx.EVT_BUTTON, self.on_bogus) manual_box = wx.BoxSizer(wx.HORIZONTAL) """ manual_box.Add(self.tp_button, border=2, flag=wx.ALIGN_CENTER_VERTICAL) manual_box.Add(self.fp_button, border=2, flag=wx.ALIGN_CENTER_VERTICAL) manual_box.Add(self.tn_button, border=2, flag=wx.ALIGN_CENTER_VERTICAL) manual_box.Add(self.fn_button, border=2, flag=wx.ALIGN_CENTER_VERTICAL) """ manual_box.Add(self.real_button, border=2, flag=wx.ALIGN_CENTER_VERTICAL) manual_box.Add(self.bogus_button, border=2, flag=wx.ALIGN_CENTER_VERTICAL) sizer.Add(manual_box, 0, wx.ALL, 10) self.SetSizer(sizer) sizer.Fit(self)
def create_checkbox(**kwargs): panel = kwargs.get('panel') value = kwargs.get('value') key = kwargs.get('key') bind = kwargs.get('bind') item_sizer = wx.BoxSizer(wx.HORIZONTAL) style = wx.ALIGN_CENTER_VERTICAL item_key = MODULE_KEY.join(key) item_box = wx.CheckBox(panel, id=id_renew(item_key, update=True), label=translate_key(item_key), style=style) item_box.SetValue(value) item_box.Bind(wx.EVT_CHECKBOX, bind) item_sizer.Add(item_box, 0, wx.ALIGN_LEFT) return {'item': item_sizer}
def __do_layout(self): # begin wxGlade: ChatFrameGui.__do_layout sizer_1 = wx.BoxSizer(wx.VERTICAL) sizer_2 = wx.BoxSizer(wx.HORIZONTAL) sizer_3 = wx.BoxSizer(wx.VERTICAL) sizer_6 = wx.BoxSizer(wx.HORIZONTAL) sizer_4 = wx.BoxSizer(wx.HORIZONTAL) sizer_4.Add(self.lblIpAddress, 0, wx.ALL|wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 3) sizer_4.Add(self.edtIPAddress, 1, wx.ALL|wx.EXPAND, 3) sizer_4.Add(self.spnConnectPort, 0, wx.ALL|wx.EXPAND, 3) sizer_4.Add(self.btnConnect, 0, wx.ALL, 3) self.panel_4.SetAutoLayout(1) self.panel_4.SetSizer(sizer_4) sizer_4.Fit(self.panel_4) sizer_4.SetSizeHints(self.panel_4) sizer_3.Add(self.panel_4, 0, wx.EXPAND, 0) sizer_6.Add(self.lblListenPort, 0, wx.ALL|wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 3) sizer_6.Add(self.spnListenPort, 1, wx.ALL|wx.EXPAND, 3) sizer_6.Add(self.btnListen, 0, wx.ALL, 3) self.panel_3.SetAutoLayout(1) self.panel_3.SetSizer(sizer_6) sizer_6.Fit(self.panel_3) sizer_6.SetSizeHints(self.panel_3) sizer_3.Add(self.panel_3, 0, wx.EXPAND, 0) sizer_3.Add(self.lblReceived, 0, 0, 0) sizer_3.Add(self.edtReceived, 1, wx.EXPAND, 0) sizer_3.Add(self.lblSent, 0, 0, 0) sizer_3.Add(self.edtSent, 1, wx.EXPAND, 0) self.panel_1.SetAutoLayout(1) self.panel_1.SetSizer(sizer_3) sizer_3.Fit(self.panel_1) sizer_3.SetSizeHints(self.panel_1) sizer_1.Add(self.panel_1, 1, wx.EXPAND, 0) sizer_2.Add(self.edtToSend, 1, wx.ALL|wx.EXPAND, 5) sizer_2.Add(self.btnSend, 0, wx.ALL, 4) sizer_2.Add(self.btnClose, 0, wx.ALL, 4) self.panel_2.SetAutoLayout(1) self.panel_2.SetSizer(sizer_2) sizer_2.Fit(self.panel_2) sizer_2.SetSizeHints(self.panel_2) sizer_1.Add(self.panel_2, 0, wx.EXPAND, 0) self.SetAutoLayout(1) self.SetSizer(sizer_1) sizer_1.Fit(self) sizer_1.SetSizeHints(self) self.Layout() # end wxGlade # end of class ChatFrameGui
def __init__(self, parent=None, default_user="", default_pass=""): wx.Panel.__init__(self, parent) border = wx.StaticBox(self, label="User authorization") sizer = wx.StaticBoxSizer(border, wx.VERTICAL) self._status_label_user = ProcessingPlaceholderText(self) self._status_label_pass = ProcessingPlaceholderText(self) username_sizer = wx.BoxSizer(wx.VERTICAL) username_label = wx.StaticText(self, label="Username") username_label.SetToolTipString("Your IRIDA username") username_sizer.Add(username_label, flag=wx.EXPAND | wx.BOTTOM, border=2) username_input_sizer = wx.BoxSizer(wx.HORIZONTAL) self._username = wx.TextCtrl(self) self._username.Bind(wx.EVT_KILL_FOCUS, self._username_changed) self._username.SetValue(default_user) username_input_sizer.Add(self._username, flag=wx.EXPAND, proportion=1) username_input_sizer.Add(self._status_label_user, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, border=5, proportion=0) username_sizer.Add(username_input_sizer, flag=wx.EXPAND) sizer.Add(username_sizer, flag=wx.EXPAND | wx.ALL, border=5) password_sizer = wx.BoxSizer(wx.VERTICAL) password_label = wx.StaticText(self, label="Password") password_label.SetToolTipString("Your IRIDA password") password_sizer.Add(password_label, flag=wx.EXPAND | wx.BOTTOM, border=2) password_input_sizer = wx.BoxSizer(wx.HORIZONTAL) self._password = wx.TextCtrl(self, style=wx.TE_PASSWORD) self._password.Bind(wx.EVT_KILL_FOCUS, self._password_changed) self._password.SetValue(default_pass) password_input_sizer.Add(self._password, flag=wx.EXPAND, proportion=1) password_input_sizer.Add(self._status_label_pass, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, border=5, proportion=0) password_sizer.Add(password_input_sizer, flag=wx.EXPAND) sizer.Add(password_sizer, flag=wx.EXPAND | wx.ALL, border=5) self.SetSizerAndFit(sizer) self.Layout() pub.subscribe(self._handle_connection_error, APIConnectorTopics.connection_error_user_credentials_topic) pub.subscribe(self._status_label_user.SetSuccess, APIConnectorTopics.connection_success_topic) pub.subscribe(self._status_label_pass.SetSuccess, APIConnectorTopics.connection_success_topic) self.Bind(wx.EVT_CLOSE, self._on_close)
def __init__(self, parent=None, default_client_id="", default_client_secret=""): wx.Panel.__init__(self, parent) border = wx.StaticBox(self, label="Client authorization") sizer = wx.StaticBoxSizer(border, wx.VERTICAL) self._client_id_status_label = ProcessingPlaceholderText(self) self._client_secret_status_label = ProcessingPlaceholderText(self) client_id_sizer = wx.BoxSizer(wx.VERTICAL) client_id_label = wx.StaticText(self, label="Client ID") client_id_label.SetToolTipString("Your IRIDA client ID") client_id_sizer.Add(client_id_label, flag=wx.EXPAND | wx.BOTTOM, border=2) client_id_input_sizer = wx.BoxSizer(wx.HORIZONTAL) self._client_id = wx.TextCtrl(self) self._client_id.Bind(wx.EVT_KILL_FOCUS, self._client_id_changed) self._client_id.SetValue(default_client_id) client_id_input_sizer.Add(self._client_id, flag=wx.EXPAND, proportion=1) client_id_input_sizer.Add(self._client_id_status_label, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, border=5, proportion=0) client_id_sizer.Add(client_id_input_sizer, flag=wx.EXPAND) sizer.Add(client_id_sizer, flag=wx.EXPAND | wx.ALL, border=5) client_secret_sizer = wx.BoxSizer(wx.VERTICAL) client_secret_label = wx.StaticText(self, label="Client Secret") client_secret_label.SetToolTipString("Your IRIDA client secret") client_secret_sizer.Add(client_secret_label, flag=wx.EXPAND | wx.BOTTOM, border=2) client_secret_input_sizer = wx.BoxSizer(wx.HORIZONTAL) self._client_secret = wx.TextCtrl(self) self._client_secret.Bind(wx.EVT_KILL_FOCUS, self._client_secret_changed) self._client_secret.SetValue(default_client_secret) client_secret_input_sizer.Add(self._client_secret, flag=wx.EXPAND, proportion=1) client_secret_input_sizer.Add(self._client_secret_status_label, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, border=5, proportion=0) client_secret_sizer.Add(client_secret_input_sizer, flag=wx.EXPAND) sizer.Add(client_secret_sizer, flag=wx.EXPAND | wx.ALL, border=5) self.SetSizerAndFit(sizer) self.Layout() pub.subscribe(self._client_id_status_label.SetError, APIConnectorTopics.connection_error_client_id_topic) pub.subscribe(self._client_secret_status_label.SetError, APIConnectorTopics.connection_error_client_secret_topic) pub.subscribe(self._client_id_status_label.SetSuccess, APIConnectorTopics.connection_success_topic) pub.subscribe(self._client_secret_status_label.SetSuccess, APIConnectorTopics.connection_success_topic) pub.subscribe(self._client_id_status_label.SetSuccess, APIConnectorTopics.connection_success_valid_client_id) pub.subscribe(self._client_secret_status_label.SetSuccess, APIConnectorTopics.connection_success_valid_client_secret) self.Bind(wx.EVT_CLOSE, self._on_close)
def __init__( self, parent, ID, title, size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE, fields=None, data=None, ): wx.Dialog.__init__ (self, parent, ID, title, pos, size, style) sizer = wx.BoxSizer(wx.VERTICAL) self.textctrls = {} for field in fields: box = wx.BoxSizer(wx.HORIZONTAL) label = wx.StaticText(self, -1, field) label.SetHelpText("This is the help text for the label") box.Add(label, 1, wx.ALIGN_CENTRE|wx.ALL, 5) text = wx.TextCtrl(self, -1, "", size=(80,-1)) text.SetHelpText("Here's some help text for field #1") if field in data: text.SetValue(repr(data[field])) box.Add(text, 1, wx.ALIGN_CENTRE|wx.ALL, 1) sizer.Add(box, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 1) self.textctrls[field] = text line = wx.StaticLine(self, -1, size=(20,-1), style=wx.LI_HORIZONTAL) sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP, 5) btnsizer = wx.StdDialogButtonSizer() btn = wx.Button(self, wx.ID_OK) btn.SetHelpText("The OK button completes the dialog") btn.SetDefault() btnsizer.AddButton(btn) btn = wx.Button(self, wx.ID_CANCEL) btn.SetHelpText("The Cancel button cancels the dialog. (Cool, huh?)") btnsizer.AddButton(btn) btnsizer.Realize() sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) self.SetSizer(sizer) sizer.Fit(self)
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, pou_type=None, type_readonly=False): wx.Dialog.__init__(self, id=-1, parent=parent, name='PouDialog', title=_('Create a new POU'), style=wx.DEFAULT_DIALOG_STYLE) main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10) main_sizer.AddGrowableCol(0) main_sizer.AddGrowableRow(0) infos_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=3, vgap=15) infos_sizer.AddGrowableCol(1) main_sizer.AddSizer(infos_sizer, border=20, flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT) pouname_label = wx.StaticText(self, label=_('POU Name:')) infos_sizer.AddWindow(pouname_label, border=4, flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP) self.PouName = wx.TextCtrl(self) infos_sizer.AddWindow(self.PouName, flag=wx.GROW) poutype_label = wx.StaticText(self, label=_('POU Type:')) infos_sizer.AddWindow(poutype_label, border=4, flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP) self.PouType = wx.ComboBox(self, style=wx.CB_READONLY) self.Bind(wx.EVT_COMBOBOX, self.OnTypeChanged, self.PouType) infos_sizer.AddWindow(self.PouType, flag=wx.GROW) language_label = wx.StaticText(self, label=_('Language:')) infos_sizer.AddWindow(language_label, border=4, flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP) self.Language = wx.ComboBox(self, style=wx.CB_READONLY) infos_sizer.AddWindow(self.Language, flag=wx.GROW) button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE) self.Bind(wx.EVT_BUTTON, self.OnOK, button_sizer.GetAffirmativeButton()) main_sizer.AddSizer(button_sizer, border=20, flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT) self.SetSizer(main_sizer) for option in GetPouTypes(): if not type_readonly or _(option) == _(pou_type): self.PouType.Append(_(option)) if pou_type is not None: self.PouType.SetStringSelection(_(pou_type)) self.RefreshLanguage() self.Fit() self.PouNames = [] self.PouElementNames = []
def _init_Editor(self, parent): self.Editor = wx.Panel(parent) main_sizer = wx.BoxSizer(wx.HORIZONTAL) left_sizer = wx.BoxSizer(wx.VERTICAL) main_sizer.AddSizer(left_sizer, 1, border=5, flag=wx.GROW | wx.ALL) managed_dir_label = wx.StaticText(self.Editor, label=_(self.TagName) + ":") left_sizer.AddWindow(managed_dir_label, border=5, flag=wx.GROW | wx.BOTTOM) self.ManagedDir = FolderTree(self.Editor, self.Folder, FILTER) left_sizer.AddWindow(self.ManagedDir, 1, flag=wx.GROW) managed_treectrl = self.ManagedDir.GetTreeCtrl() self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnTreeItemChanged, managed_treectrl) if self.EnableDragNDrop: self.Bind(wx.EVT_TREE_BEGIN_DRAG, self.OnTreeBeginDrag, managed_treectrl) button_sizer = wx.BoxSizer(wx.VERTICAL) main_sizer.AddSizer(button_sizer, border=5, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL) for idx, (name, bitmap, help) in enumerate([ ("DeleteButton", "remove_element", _("Remove file from left folder")), ("LeftCopyButton", "LeftCopy", _("Copy file from right folder to left")), ("RightCopyButton", "RightCopy", _("Copy file from left folder to right")), ("EditButton", "edit", _("Edit file"))]): button = wx.lib.buttons.GenBitmapButton( self.Editor, bitmap=GetBitmap(bitmap), size=wx.Size(28, 28), style=wx.NO_BORDER) button.SetToolTipString(help) setattr(self, name, button) if idx > 0: flag = wx.TOP else: flag = 0 self.Bind(wx.EVT_BUTTON, getattr(self, "On" + name), button) button_sizer.AddWindow(button, border=20, flag=flag) right_sizer = wx.BoxSizer(wx.VERTICAL) main_sizer.AddSizer(right_sizer, 1, border=5, flag=wx.GROW | wx.ALL) if wx.Platform == '__WXMSW__': system_dir_label = wx.StaticText(self.Editor, label=_("My Computer:")) else: system_dir_label = wx.StaticText(self.Editor, label=_("Home Directory:")) right_sizer.AddWindow(system_dir_label, border=5, flag=wx.GROW | wx.BOTTOM) self.SystemDir = FolderTree(self.Editor, self.HomeDirectory, FILTER, False) right_sizer.AddWindow(self.SystemDir, 1, flag=wx.GROW) system_treectrl = self.SystemDir.GetTreeCtrl() self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnTreeItemChanged, system_treectrl) self.Editor.SetSizer(main_sizer)
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)
def __do_layout(self): # begin wxGlade: SerialConfigDialog.__do_layout sizer_2 = wx.BoxSizer(wx.VERTICAL) sizer_3 = wx.BoxSizer(wx.HORIZONTAL) self.sizer_flow_staticbox.Lower() sizer_flow = wx.StaticBoxSizer(self.sizer_flow_staticbox, wx.HORIZONTAL) self.sizer_timeout_staticbox.Lower() sizer_timeout = wx.StaticBoxSizer(self.sizer_timeout_staticbox, wx.HORIZONTAL) self.sizer_format_staticbox.Lower() sizer_format = wx.StaticBoxSizer(self.sizer_format_staticbox, wx.VERTICAL) grid_sizer_1 = wx.FlexGridSizer(3, 2, 0, 0) self.sizer_1_staticbox.Lower() sizer_1 = wx.StaticBoxSizer(self.sizer_1_staticbox, wx.VERTICAL) sizer_basics = wx.FlexGridSizer(3, 2, 0, 0) sizer_basics.Add(self.label_2, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 4) sizer_basics.Add(self.choice_port, 0, wx.EXPAND, 0) sizer_basics.Add(self.label_1, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 4) sizer_basics.Add(self.combo_box_baudrate, 0, wx.EXPAND, 0) sizer_basics.AddGrowableCol(1) sizer_1.Add(sizer_basics, 0, wx.EXPAND, 0) sizer_2.Add(sizer_1, 0, wx.EXPAND, 0) grid_sizer_1.Add(self.label_3, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 4) grid_sizer_1.Add(self.choice_databits, 1, wx.EXPAND | wx.ALIGN_RIGHT, 0) grid_sizer_1.Add(self.label_4, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 4) grid_sizer_1.Add(self.choice_stopbits, 1, wx.EXPAND | wx.ALIGN_RIGHT, 0) grid_sizer_1.Add(self.label_5, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 4) grid_sizer_1.Add(self.choice_parity, 1, wx.EXPAND | wx.ALIGN_RIGHT, 0) sizer_format.Add(grid_sizer_1, 1, wx.EXPAND, 0) self.panel_format.SetSizer(sizer_format) sizer_2.Add(self.panel_format, 0, wx.EXPAND, 0) sizer_timeout.Add(self.checkbox_timeout, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 4) sizer_timeout.Add(self.text_ctrl_timeout, 0, 0, 0) sizer_timeout.Add(self.label_6, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 4) self.panel_timeout.SetSizer(sizer_timeout) sizer_2.Add(self.panel_timeout, 0, wx.EXPAND, 0) sizer_flow.Add(self.checkbox_rtscts, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 4) sizer_flow.Add(self.checkbox_xonxoff, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 4) sizer_flow.Add((10, 10), 1, wx.EXPAND, 0) self.panel_flow.SetSizer(sizer_flow) sizer_2.Add(self.panel_flow, 0, wx.EXPAND, 0) sizer_3.Add(self.button_ok, 0, 0, 0) sizer_3.Add(self.button_cancel, 0, 0, 0) sizer_2.Add(sizer_3, 0, wx.ALL | wx.ALIGN_RIGHT, 4) self.SetSizer(sizer_2) sizer_2.Fit(self) self.Layout() # end wxGlade
def create_main_panel(self): self.panel = wx.Panel(self) self.set_text = wx.StaticText(self.panel, -1, label="Showing : All (%d examples)" % self.m) self.set_text.SetBackgroundColour(wx.WHITE) font = wx.Font(20, wx.MODERN, wx.NORMAL, wx.BOLD) self.set_text.SetFont(font) self.hbox1 = wx.BoxSizer(wx.HORIZONTAL) self.hbox1.Add(self.set_text, border=5, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL) self.draw_fig(True) self.canvas = FigCanvas(self.panel, -1, self.fig) # Bind the 'click' event for clicking on one of the axes self.canvas.mpl_connect('button_press_event', self.on_click) self.navigation_control = NavigationControlBox(self.panel, self, -1, "navigation control") #self.label_key_box = LabelKeyBox(self.panel,-1) self.data_set_control = DataSetControlBox(self.panel,self,-1) self.build_button = wx.Button(self.panel, -1, label="Build") self.build_button.Bind(wx.EVT_BUTTON, self.on_build) self.reset_button = wx.Button(self.panel, -1, label="Reset") self.reset_button.Bind(wx.EVT_BUTTON, self.on_reset) self.exit_button = wx.Button(self.panel, -1, label="Exit") self.exit_button.Bind(wx.EVT_BUTTON, self.on_exit) self.vbox1 = wx.BoxSizer(wx.VERTICAL) self.vbox1.Add(self.build_button, 0, flag=wx.CENTER | wx.BOTTOM) self.vbox1.Add(self.reset_button, 0, flag=wx.CENTER | wx.BOTTOM) self.vbox1.Add(self.exit_button, 0, flag=wx.CENTER | wx.BOTTOM) self.hbox2 = wx.BoxSizer(wx.HORIZONTAL) #self.hbox2.Add(self.label_key_box, border=5, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL) self.hbox2.Add(self.data_set_control, border=5, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL) self.hbox2.Add(self.navigation_control, border=5, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL) self.hbox2.Add(self.vbox1, border=5, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL) self.vbox2 = wx.BoxSizer(wx.VERTICAL) self.vbox2.Add(self.hbox1, 0, flag=wx.CENTER | wx.TOP) self.vbox2.Add(self.canvas, 1, flag=wx.CENTER | wx.CENTER | wx.GROW) self.vbox2.Add(self.hbox2, 0, flag=wx.LEFT | wx.TOP) self.panel.SetSizer(self.vbox2) self.vbox2.Fit(self)