我们从Python开源项目中,提取了以下38个代码示例,用于说明如何使用wx.FlexGridSizer()。
def __do_layout(self): # begin wxGlade: Dialog_snapshot.__do_layout sizer_2 = wx.BoxSizer(wx.VERTICAL) grid_sizer_2 = wx.FlexGridSizer(4, 2, 10, 10) grid_sizer_2.Add(self.label_1, 0, 0, 0) grid_sizer_2.Add(self.nombre_snap, 0, 0, 0) grid_sizer_2.Add(self.label_2, 0, 0, 0) grid_sizer_2.Add(self.descripcion_snap, 0, 0, 0) grid_sizer_2.Add(self.checkbox_memory, 0, 0, 0) grid_sizer_2.Add(self.checkbox_quiesce, 0, 0, 0) grid_sizer_2.Add(self.snap_ok, 0, wx.ALIGN_RIGHT | wx.RIGHT, 0) grid_sizer_2.Add(self.snap_cancel, 0, 0, 0) grid_sizer_2.AddGrowableCol(1) sizer_2.Add(grid_sizer_2, 1, wx.ALL | wx.EXPAND, 10) self.SetSizer(sizer_2) sizer_2.Fit(self) self.Layout() # end wxGlade # end of class Dialog_snapshot
def __do_layout(self): # begin wxGlade: Dialogo_user_pass.__do_layout sizer_3 = wx.BoxSizer(wx.VERTICAL) grid_sizer_4 = wx.FlexGridSizer(1, 2, 0, 0) grid_sizer_1 = wx.FlexGridSizer(2, 2, 5, 5) grid_sizer_1.Add(self.label_3, 0, 0, 0) grid_sizer_1.Add(self.usuario, 0, 0, 0) grid_sizer_1.Add(self.label_4, 0, 0, 0) grid_sizer_1.Add(self.password, 0, 0, 0) grid_sizer_1.AddGrowableCol(0) sizer_3.Add(grid_sizer_1, 1, wx.ALIGN_CENTER | wx.ALIGN_RIGHT | wx.ALL | wx.EXPAND, 10) grid_sizer_4.Add(self.button_OK, 0, 0, 0) grid_sizer_4.Add(self.button_cancel, 0, wx.ALIGN_RIGHT, 0) sizer_3.Add(grid_sizer_4, 1, wx.ALIGN_RIGHT | wx.ALL, 4) self.SetSizer(sizer_3) sizer_3.Fit(self) self.Layout() # end wxGlade # end of class Dialogo_user_pass
def __do_layout(self): # begin wxGlade: Dialogo_acceso_vcenter.__do_layout sizer_6 = wx.BoxSizer(wx.VERTICAL) grid_sizer_6 = wx.FlexGridSizer(1, 2, 0, 0) grid_sizer_5 = wx.FlexGridSizer(4, 2, 5, 5) grid_sizer_5.Add(self.label_7, 0, 0, 0) grid_sizer_5.Add(self.nombre_vcenter, 0, 0, 0) grid_sizer_5.Add(self.label_9, 0, 0, 0) grid_sizer_5.Add(self.login_vcenter, 0, 0, 0) grid_sizer_5.Add(self.label_10, 0, 0, 0) grid_sizer_5.Add(self.passwor_vcenter, 0, 0, 0) grid_sizer_5.Add(self.label_8, 0, 0, 0) grid_sizer_5.Add(self.puert_vcenter, 0, 0, 0) sizer_6.Add(grid_sizer_5, 1, wx.ALIGN_CENTER | wx.ALIGN_RIGHT | wx.ALL | wx.EXPAND, 10) grid_sizer_6.Add(self.button_Exit, 0, wx.RIGHT, 3) grid_sizer_6.Add(self.button_Connect, 0, 0, 0) sizer_6.Add(grid_sizer_6, 1, wx.ALIGN_RIGHT | wx.ALL, 4) self.SetSizer(sizer_6) self.Layout() # end wxGlade # end of class Dialogo_acceso_vcenter
def __init__(self, parent, enable_required=True): wx.Dialog.__init__(self, parent, title=_('Project properties'), 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) self.ProjectProperties = ProjectPropertiesPanel( self, enable_required=enable_required) main_sizer.AddWindow(self.ProjectProperties, flag=wx.GROW) self.ButtonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE) self.Bind(wx.EVT_BUTTON, self.OnOK, self.ButtonSizer.GetAffirmativeButton()) main_sizer.AddSizer(self.ButtonSizer, border=20, flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT) self.SetSizer(main_sizer) self.ProjectProperties.Fit() self.Fit()
def __init__(self, parent): wx.Control.__init__(self, parent) main_sizer = wx.FlexGridSizer(cols=2, hgap=0, rows=1, vgap=0) main_sizer.AddGrowableCol(0) main_sizer.AddGrowableRow(0) # create location text control self.Location = wx.TextCtrl(self, size=wx.Size(0, -1), style=wx.TE_PROCESS_ENTER) self.Location.Bind(wx.EVT_KEY_DOWN, self.OnLocationChar) main_sizer.AddWindow(self.Location, flag=wx.GROW) # create browse button self.BrowseButton = wx.Button(self, label='...', size=wx.Size(30, -1)) self.BrowseButton.Bind(wx.EVT_BUTTON, self.OnBrowseButtonClick) main_sizer.AddWindow(self.BrowseButton, flag=wx.GROW) self.Bind(wx.EVT_SIZE, self.OnSize) self.SetSizer(main_sizer) self.Controller = None self.VarType = None self.Default = False
def _create_NetworkEditor(self, prnt): self.NetworkEditor = wx.Panel( id=-1, parent=prnt, pos=wx.Point(0, 0), size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL) NetworkEditorTemplate._init_ctrls(self, self.NetworkEditor) main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=1, vgap=0) main_sizer.AddGrowableCol(0) main_sizer.AddGrowableRow(0) main_sizer.AddWindow(self.NetworkNodes, 0, border=5, flag=wx.GROW | wx.ALL) self.NetworkEditor.SetSizer(main_sizer) return self.NetworkEditor
def on_pt(event): if self.flagRB == 1: dlg.view.AddTextCtrl(cont_sup, widget_name='pointi', initial='5500') # self.qpStatLin = wx.StaticText(self.dlg, -1, "Q value for P-Wave:") # self.qpChoiceBox = wx.Choice(self.dlg, -1, choices=self.logOptions.keys()) # self.qsStatLin = wx.StaticText(self.dlg, -1, "Q value for S-Wave:") # self.qsChoiceBox = wx.Choice(self.dlg, -1, choices=self.logOptions.keys()) # self.qSizer = wx.FlexGridSizer(cols=2, hgap=3, vgap=3) # self.qSizer.AddGrowableCol(1) # self.qSizer.Add(self.qpStatLin, 0, wx.ALL, 5) # self.qSizer.Add(self.qpChoiceBox, 0, wx.EXPAND|wx.ALL, 5) # self.qSizer.Add(self.qsStatLin, 0, wx.ALL, 5) # self.qSizer.Add(self.qsChoiceBox, 0, wx.EXPAND|wx.ALL, 5) # self.mainSizer.Insert(8, self.qSizer, 0, wx.EXPAND|wx.ALL, 5) # self.flagRB = 0 # self.dlg.SetSize((610, 860))
def __init__(self, *args, **kwargs): super(PropertyEntryDialog, self).__init__(*args, **kwargs) fgs = wx.FlexGridSizer(2, 2, 5, 5) name_label = wx.StaticText(self, label="Nome: ") unit_label = wx.StaticText(self, label="Unidade: ") self.name_ctrl = wx.TextCtrl(self) self.unit_ctrl = wx.TextCtrl(self) fgs.AddMany([(name_label), (self.name_ctrl, 1, wx.EXPAND), (unit_label), (self.unit_ctrl, 1, wx.EXPAND)]) fgs.AddGrowableCol(1, 1) sizer = wx.BoxSizer(wx.VERTICAL) button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL) #if _iswxphoenix: sizer.Add(fgs, proportion=1, flag=wx.EXPAND) sizer.Add(button_sizer, proportion=0, flag=wx.EXPAND) #else: # sizer.AddSizer(fgs, proportion=1, flag=wx.EXPAND) # sizer.AddSizer(button_sizer, proportion=0, flag=wx.EXPAND) self.SetSizer(sizer)
def __init__(self, *args, **kwargs): super(PropertyEntryDialog, self).__init__(*args, **kwargs) fgs = wx.FlexGridSizer(2, 2, 5, 5) name_label = wx.StaticText(self, label="Nome: ") unit_label = wx.StaticText(self, label="Unidade: ") self.name_ctrl = wx.TextCtrl(self) self.unit_ctrl = wx.TextCtrl(self) fgs.AddMany([(name_label), (self.name_ctrl, 1, wx.EXPAND), (unit_label), (self.unit_ctrl, 1, wx.EXPAND)]) fgs.AddGrowableCol(1, 1) sizer = wx.BoxSizer(wx.VERTICAL) button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL) sizer.Add(fgs, proportion=1, flag=wx.EXPAND) sizer.Add(button_sizer, proportion=0, flag=wx.EXPAND) self.SetSizer(sizer)
def on_yes_rb(self, event): if self.flagRB == 1: self.qpStatLin = wx.StaticText(self.dlg, -1, "Q value for P-Wave:") self.qpChoiceBox = wx.Choice(self.dlg, -1, choices=self.logOptions.keys()) self.qsStatLin = wx.StaticText(self.dlg, -1, "Q value for S-Wave:") self.qsChoiceBox = wx.Choice(self.dlg, -1, choices=self.logOptions.keys()) self.qSizer = wx.FlexGridSizer(cols=2, hgap=3, vgap=3) self.qSizer.AddGrowableCol(1) self.qSizer.Add(self.qpStatLin, 0, wx.ALL, 5) self.qSizer.Add(self.qpChoiceBox, 0, wx.EXPAND|wx.ALL, 5) self.qSizer.Add(self.qsStatLin, 0, wx.ALL, 5) self.qSizer.Add(self.qsChoiceBox, 0, wx.EXPAND|wx.ALL, 5) self.mainSizer.Insert(8, self.qSizer, 0, wx.EXPAND|wx.ALL, 5) self.flagRB = 0 self.dlg.SetSize((610, 860))
def __init__(self, parent, name, number, minnamelen, maxnamelen): wxskinDialog.__init__(self, parent, -1, "Phonebook edit entry") self.SetAutoLayout(True) self.name = None self.number = None nameTextId = wx.NewId() # Main window resizer object border = wx.BoxSizer(wx.VERTICAL) label = wx.StaticText(self, -1, "Enter the phonebook entry name, number and press OK.") border.Add(label, 1, wx.ALL, 10) #fgs = wx.FlexGridSizer(2,3,5,20) fgs = wx.BoxSizer(wx.HORIZONTAL) label = wx.StaticText(self, -1, "Name (max %d): " % maxnamelen) fgs.Add(label, 1, wx.ALIGN_LEFT | wx.LEFT, 10) self.nameCtrl = wx.TextCtrl(self, nameTextId, name, validator = pySIMvalidator(None, minnamelen, maxnamelen)) fgs.Add(self.nameCtrl, 1, wx.ALIGN_RIGHT | wx.RIGHT, 10) border.Add(fgs, 1, wx.ALL) fgs = wx.BoxSizer(wx.HORIZONTAL) label = wx.StaticText(self, -1, "Number (max 20): ") fgs.Add(label, 1, wx.ALIGN_LEFT | wx.LEFT, 10) self.numberCtrl = wx.TextCtrl(self, -1, number, validator = pySIMvalidator("+*#pw0123456789", None, 20)) fgs.Add(self.numberCtrl, 1, wx.ALIGN_RIGHT | wx.RIGHT, 10) border.Add(fgs, 1, wx.ALL) buttons = wx.BoxSizer(wx.HORIZONTAL) buttons.Add(wx.Button(self, ID_BUTTON_OK, "Okay"), 1, wx.ALIGN_LEFT | wx.ALL, 20) buttons.Add(wx.Button(self, wx.ID_CANCEL, "Cancel"), 1, wx.ALIGN_RIGHT | wx.ALL, 20) border.Add(buttons, 1, wx.ALL) wx.EVT_BUTTON(self, ID_BUTTON_OK, self.onOK) wx.EVT_TEXT_ENTER(self, nameTextId, self.onOK) self.SetAutoLayout(1); self.SetSizer(border) border.Fit(self) self.Layout()
def __do_layout(self): # begin wxGlade: Dialogo_ejecutando.__do_layout grid_sizer_3 = wx.FlexGridSizer(1, 2, 0, 0) grid_sizer_3.Add(self.titulo, 0, wx.ALIGN_CENTER | wx.ALL, 4) grid_sizer_3.Add(self.elementos, 0, wx.ALIGN_CENTER | wx.ALL, 4) self.SetSizer(grid_sizer_3) grid_sizer_3.Fit(self) self.Layout() # end wxGlade # end of class Dialogo_ejecutando
def __init__(self,parent=None,fname=None): wx.Notebook.__init__(self,parent,style=wx.TAB_TRAVERSAL) self.parent = parent if not fname: fname = 'my_library.db' self.db_conn = sqlite3.connect(fname); self.db_conn.row_factory = sqlite3.Row self.db_cursor = self.db_conn.cursor(); self.db_cursor.execute('select * from cards') self.my_library = self.db_cursor.fetchall() # ***** initialize the my_library tab ***** self.my_library_tab = wx.ScrolledWindow(self) self.my_library_grid = wx.grid.Grid(self.my_library_tab) self.my_library_grid.SetMinSize((350,355)) self.current_row = -1 my_library_sizer = wx.FlexGridSizer(rows=1,cols=1) my_library_sizer.SetMinSize(size=(350,363)) self.my_library_tab.SetSizer(my_library_sizer) self.my_library_grid.CreateGrid(0,0) self.my_library_grid.EnableEditing(False) self.my_library_grid.SetColLabelSize(wx.grid.GRID_AUTOSIZE) self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_CLICK, self.change_sort_by) self.my_library_fields = ['Card Name','Qty'] self.my_library_sort_by = ['Card Name','v'] my_library_sizer.Add(item=self.my_library_grid,flag=wx.EXPAND) my_library_sizer.AddGrowableCol(0,1) my_library_sizer.AddGrowableRow(0,1) self.AddPage(self.my_library_tab,text='My Library') self.my_library_grid.Bind(wx.grid.EVT_GRID_SELECT_CELL,self.cell_selected) self.update_my_library_grid()
def __init__(self, parent, name, library, default=None): wx.Dialog.__init__(self, name='BrowseValueDialog', parent=parent, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER, title=_('Browse %s values library') % name) self.staticText1 = wx.StaticText( label=_('Choose a value for %s:') % name, name='staticText1', parent=self, pos=wx.Point(0, 0), size=wx.DefaultSize, style=0) self.ValuesLibrary = wx.TreeCtrl( name='ValuesLibrary', parent=self, pos=wx.Point(0, 0), size=wx.Size(400, 200), style=wx.TR_HAS_BUTTONS | wx.TR_SINGLE | wx.SUNKEN_BORDER | wx.TR_HIDE_ROOT | wx.TR_LINES_AT_ROOT) self.ButtonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE) self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId()) self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=10) self.flexGridSizer1.AddWindow(self.staticText1, 0, border=20, flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT) self.flexGridSizer1.AddWindow(self.ValuesLibrary, 0, border=20, flag=wx.GROW | wx.LEFT | wx.RIGHT) self.flexGridSizer1.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT) self.flexGridSizer1.AddGrowableCol(0) self.flexGridSizer1.AddGrowableRow(1) self.SetSizer(self.flexGridSizer1) self.Fit() root = self.ValuesLibrary.AddRoot("") self.GenerateValuesLibraryBranch(root, library, default)
def _init_sizers(self): self.MainSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=10) self.ButtonGridSizer = wx.FlexGridSizer(cols=4, hgap=5, rows=1, vgap=0) self._init_coll_MainSizer_Items(self.MainSizer) self._init_coll_MainSizer_Growables(self.MainSizer) self._init_coll_ButtonGridSizer_Items(self.ButtonGridSizer) self._init_coll_ButtonGridSizer_Growables(self.ButtonGridSizer) self.SetSizer(self.MainSizer)
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__(self, parent): wx.Dialog.__init__(self, parent, title=_('Edit Duration')) main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10) main_sizer.AddGrowableCol(0) main_sizer.AddGrowableRow(0) controls_sizer = wx.FlexGridSizer(cols=len(CONTROLS), hgap=10, rows=2, vgap=10) main_sizer.AddSizer(controls_sizer, border=20, flag=wx.TOP | wx.LEFT | wx.RIGHT | wx.GROW) controls = [] for i, (name, label) in enumerate(CONTROLS): controls_sizer.AddGrowableCol(i) st = wx.StaticText(self, label=label) txtctrl = wx.TextCtrl(self, value='0', style=wx.TE_PROCESS_ENTER) self.Bind(wx.EVT_TEXT_ENTER, self.GetControlValueTestFunction(txtctrl), txtctrl) setattr(self, name, txtctrl) controls.append((st, txtctrl)) for st, txtctrl in controls: controls_sizer.AddWindow(st, flag=wx.GROW) for st, txtctrl in controls: controls_sizer.AddWindow(txtctrl, 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) self.Fit() self.Days.SetFocus()
def _init_sizers(self): self.MainSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0) self.HeaderSizer = wx.BoxSizer(wx.HORIZONTAL) self._init_coll_MainSizer_Items(self.MainSizer) self._init_coll_MainSizer_Growables(self.MainSizer) self._init_coll_HeaderSizer_Items(self.HeaderSizer) self.SetSizer(self.MainSizer)
def __init__(self, app): # First, call the base class' __init__ method to create the frame wx.Frame.__init__(self, None, -1, "wxPython/Autobahn WebSocket Demo") self._app = app # Associate some events with methods of this class self.Bind(wx.EVT_MOVE, self.OnMove) # Add a panel and some controls to display the size and position panel = wx.Panel(self, -1) label1 = wx.StaticText(panel, -1, "WebSocket messages received:") label2 = wx.StaticText(panel, -1, "Window position:") self.sizeCtrl = wx.TextCtrl(panel, -1, "", style=wx.TE_READONLY) self.posCtrl = wx.TextCtrl(panel, -1, "", style=wx.TE_READONLY) self.panel = panel # Use some sizers for layout of the widgets sizer = wx.FlexGridSizer(2, 2, 5, 5) sizer.Add(label1) sizer.Add(self.sizeCtrl) sizer.Add(label2) sizer.Add(self.posCtrl) border = wx.BoxSizer() border.Add(sizer, 0, wx.ALL, 15) panel.SetSizerAndFit(border) self.Fit() # This method is called by the System when the window is moved, # because of the association above.
def __init__(self, parent, title, label): wx.Dialog.__init__(self, parent, 20, title, wx.DefaultPosition, wx.Size(300, 140)) vbox = wx.BoxSizer(wx.VERTICAL) hbox = wx.BoxSizer(wx.HORIZONTAL) buttonbox = wx.BoxSizer(wx.HORIZONTAL) fgs = wx.FlexGridSizer(3, 2, 9, 5) self.title_tc1 = wx.StaticText(self, label=label) self.tc1 = wx.TextCtrl(self, size=(150, 25)) self.max = IntCtrl( self, size=(150, 25) ) self.max.Enable( True ) self.max.Hide() fgs.AddMany([(self.title_tc1), (self.tc1, 1, wx.EXPAND)]) fgs.AddMany([(self.title_tc1), (self.max, 1, wx.EXPAND)]) fgs.AddGrowableRow(2, 1) fgs.AddGrowableCol(1, 1) hbox.Add(fgs, flag=wx.ALL | wx.EXPAND, border=15) self.b_ok = wx.Button(self, label='Ok', id=OK_DIALOG) self.b_cancel = wx.Button(self, label='Cancel', id=CANCEL_DIALOG) buttonbox.Add(self.b_ok, 1, border=15) buttonbox.Add(self.b_cancel, 1, border=15) vbox.Add(hbox, flag=wx.ALIGN_CENTER | wx.ALL | wx.EXPAND) vbox.Add(buttonbox, flag=wx.ALIGN_CENTER) self.SetSizer(vbox)
def _create_sizer(self): border_sizer = wx.BoxSizer(wx.HORIZONTAL) border_sizer.AddSpacer(2) item_sizer = wx.FlexGridSizer(0, 0, 10, 10) border_sizer.Add(item_sizer, 0, wx.EXPAND) border_sizer.AddSpacer(2) self.SetSizer(border_sizer) return item_sizer
def _create_item(self, channel, icon, multiple): item_sizer = wx.BoxSizer(wx.VERTICAL) module_sizer = wx.FlexGridSizer(0, 0, 5, 3) bitmap = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap(icon), size=wx.Size(16, 16)) module_sizer.Add(bitmap, 0, wx.EXPAND) channel_name = '{}: '.format(channel) if multiple else '' channel_text = wx.StaticText(self, id=wx.ID_ANY, label=channel_name) module_sizer.Add(channel_text, 0, wx.EXPAND) label = wx.StaticText(self, id=wx.ID_ANY, label='N/A') module_sizer.Add(label, 1, wx.EXPAND) module_sizer.AddSpacer(2) item_sizer.Add(module_sizer, 0, wx.EXPAND) status_sizer = wx.BoxSizer(wx.HORIZONTAL) status_item = wx.Panel(self, size=wx.Size(-1, 5)) status_item.SetBackgroundColour('gray') status_sizer.Add(status_item, 1, wx.EXPAND) item_sizer.AddSpacer(3) item_sizer.Add(status_sizer, 1, wx.EXPAND) item_sizer.AddSpacer(2) self.border_sizer.Add(item_sizer, 0, wx.EXPAND) return {'item': item_sizer, 'label': label, 'status': status_item, 'name': channel_text, 'channel': channel}
def create_preorder(self): self.w = self.sized = (self.w or wx.FlexGridSizer(self.rows, self.cols, self.vgap, self.hgap))
def CreateContainer(self, container_type_name, *args, **kwargs): try: if container_type_name == 'BoxSizer': container_class = BoxSizerContainer elif container_type_name == 'GridSizer': container_class = GridSizerContainer elif container_type_name == 'FlexGridSizer': container_class = FlexGridSizerContainer elif container_type_name == 'GridBagSizer': container_class = GridBagSizerContainer elif container_type_name == 'StaticBox': container_class = StaticBoxContainer elif container_type_name == 'WarpSizer': container_class = WarpSizerContainer else: raise Exception('Unregistered container.') #print 'CreateContainer:', container_class, args, kwargs if not args: #print 'self.mainpanel:', self.mainpanel parent = self.mainpanel else: parent = args[0] container = container_class(parent, **kwargs) #print 'CreateContainer fim' return container except: raise
def __init__(self, *args, **kwargs): if not kwargs: kwargs = {'sizer_class': wx.FlexGridSizer} else: kwargs['sizer_class'] = wx.FlexGridSizer super(FlexGridSizerContainer, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): super(Panel, self).__init__(*args, **kwargs) self._OM = ObjectManager(self) self.xselector = wx.Choice(self) self.yselector = wx.Choice(self) self.zselector = wx.Choice(self) self.wselector = wx.Choice(self) gridsizer = wx.FlexGridSizer(rows=4, cols=2, hgap=5, vgap=5) gridsizer.Add(wx.StaticText(self, label="Eixo x: "), 0, wx.ALIGN_RIGHT) gridsizer.Add(self.xselector, 1, wx.EXPAND) gridsizer.Add(wx.StaticText(self, label="Eixo y: "), 0, wx.ALIGN_RIGHT) gridsizer.Add(self.yselector, 1, wx.EXPAND) gridsizer.Add(wx.StaticText(self, label="Barra de cor: "), 0, wx.ALIGN_RIGHT) gridsizer.Add(self.zselector, 1, wx.EXPAND) gridsizer.Add(wx.StaticText(self, label="Particionamento: "), 0, wx.ALIGN_RIGHT) gridsizer.Add(self.wselector, 1, wx.EXPAND) self.SetSizer(gridsizer) self.xmap = [] self.ixmap = {} self.ymap = [] self.iymap = {} self.zmap = [] self.izmap = {} self.wmap = [] self.iwmap = {} self.welluid = None
def __init__(self, labels, *args, **kwargs): super(LogInputPanel, self).__init__(*args, **kwargs) fgs = wx.FlexGridSizer(len(labels), 2, 4, 4) self.choices = [] for label in labels: st = wx.StaticText(self, label=label + ": ") choice = wx.Choice(self) fgs.Add(st) fgs.Add(choice) self.choices.append(choice) fgs.AddGrowableCol(1, 1) self.SetSizer(fgs)
def _layout_widgets(self, inputdesc): nwidgets = len(self.widgets) fgridsizer = wx.FlexGridSizer(nwidgets, 2, 5, 5) for i, idesc in enumerate(inputdesc): dispname = idesc['dispname'] + ":" name = idesc['name'] widget = self.widgets[name] label = wx.StaticText(self, label=dispname) fgridsizer.Add(label, proportion=0.0, flag=wx.ALIGN_RIGHT) fgridsizer.Add(widget.get_uiobj(), proportion=1.0, flag=wx.EXPAND) if idesc['type'] == 'ommulti': fgridsizer.AddGrowableRow(i) # if idesc['type'] == 'ommulti': # fgridsizer.Add(widget.get_uiobj(), proportion=1.0, flag=wx.EXPAND) # else: # fgridsizer.Add(widget.get_uiobj(), proportion=0.0, flag=wx.EXPAND) fgridsizer.AddGrowableCol(1) self.SetSizerAndFit(fgridsizer)
def _init_sizers(self): # generated method, don't edit self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0) self.flexGridSizer1.SetMinSize(wx.Size(200, 121)) self.flexGridSizer1.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self._init_coll_flexGridSizer1_Growables(self.flexGridSizer1) self._init_coll_flexGridSizer1_Items(self.flexGridSizer1) self.SetSizer(self.flexGridSizer1)
def __init__(self, parent, sms): wxskinDialog.__init__(self, parent, -1, "SMS edit") self.SetAutoLayout(False) self.sms = sms # Main window resizer object sizer = wx.BoxSizer(wx.VERTICAL) sizer = wx.FlexGridSizer(4,1) self.smsLabel = wx.StaticText(self, -1, "Message Text (%d / 160)" % len(sms.message)) sizer.Add(self.smsLabel, 1, wx.ALIGN_CENTER | wx.ALL, 5) smsTextId = wx.NewId() self.smsText = wx.TextCtrl(self, smsTextId, sms.message, size=(300,100), style=wx.TE_MULTILINE | wx.TE_LINEWRAP, validator = pySIMvalidator(None, None, 160)) sizer.Add(self.smsText, 1, wx.ALIGN_CENTER | wx.ALL, 5) hsizer = wx.FlexGridSizer(2,3) label = wx.StaticText(self, -1, "Date: ") hsizer.Add(label, 1, wx.ALL, 5) label = wx.StaticText(self, -1, "From: ") hsizer.Add(label, 1, wx.ALL, 5) label = wx.StaticText(self, -1, "Status: ") hsizer.Add(label, 1, wx.ALL, 5) text = wx.TextCtrl(self, -1, self.sms.timestamp, style=wx.TE_READONLY) hsizer.Add(text, 1, wx.ALL, 5) self.numberCtrl = wx.TextCtrl(self, -1, self.sms.number, validator = pySIMvalidator("+*#pw0123456789", None, 20)) hsizer.Add(self.numberCtrl, 1, wx.ALL, 5) choiceList = ['Read', 'Unread', 'Deleted'] self.ch = wx.Choice(self, -1, (80, 50), choices = choiceList) for i in range(len(choiceList)): if sms.status == choiceList[i]: self.ch.SetSelection(i) break hsizer.Add(self.ch, 1, wx.ALL, 5) sizer.Add(hsizer, 1, wx.ALL, 5) buttons = wx.BoxSizer(wx.HORIZONTAL) buttons.Add(wx.Button(self, ID_BUTTON_OK, "Save"), 1, wx.ALIGN_LEFT | wx.ALL, 20) buttons.Add(wx.Button(self, wx.ID_CANCEL, "Cancel"), 1, wx.ALIGN_RIGHT | wx.ALL, 20) sizer.Add(buttons, 1, wx.ALIGN_CENTER | wx.ALL, 5) wx.EVT_BUTTON(self, ID_BUTTON_OK, self.onOK) wx.EVT_TEXT(self.smsText, smsTextId, self.smsTextChange) self.SetAutoLayout(1); self.SetSizer(sizer) sizer.Fit(self) self.Layout()
def __init__(self, parent, datatypes, infos): wx.Dialog.__init__(self, parent, title=_('Edit array type properties')) main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=10) main_sizer.AddGrowableCol(0) main_sizer.AddGrowableRow(1) top_sizer = wx.BoxSizer(wx.HORIZONTAL) main_sizer.AddSizer(top_sizer, border=20, flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT) basetype_label = wx.StaticText(self, label=_('Base Type:')) top_sizer.AddWindow(basetype_label, 1, flag=wx.ALIGN_BOTTOM) self.BaseType = wx.ComboBox(self, style=wx.CB_READONLY) top_sizer.AddWindow(self.BaseType, 1, flag=wx.GROW) self.Dimensions = CustomEditableListBox(self, label=_("Dimensions:"), style=(wx.gizmos.EL_ALLOW_NEW | wx.gizmos.EL_ALLOW_EDIT | wx.gizmos.EL_ALLOW_DELETE)) for func in ["_OnLabelEndEdit", "_OnAddButton", "_OnDelButton", "_OnUpButton", "_OnDownButton"]: setattr(self.Dimensions, func, self.OnDimensionsChanged) main_sizer.AddSizer(self.Dimensions, border=20, flag=wx.GROW | wx.LEFT | wx.RIGHT) 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 datatype in datatypes: self.BaseType.Append(datatype) if isinstance(infos, TupleType) and infos[0] == "array": self.BaseType.SetStringSelection(infos[1]) self.Dimensions.SetStrings(map(lambda x: "..".join(x), infos[2])) elif infos in datatypes: self.BaseType.SetStringSelection(infos) self.BaseType.SetFocus() self.Fit()
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 __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 __init__(self, a_entry, *args, **kwargs): """ create a new AddBookForm :param a_entry: a dict for the address book entry """ wx.Panel.__init__(self, *args, **kwargs) self._entry = a_entry ## create text boxes to edit: first name, last name, phone, email. self.fname_text = wx.TextCtrl(self) self.lname_text = wx.TextCtrl(self) ## still need phone and email here... ## use a FlexGridSizer: S = wx.FlexGridSizer(rows=0, cols=2, vgap=8, hgap=8) S.AddGrowableCol(idx=1, proportion=1) S.Add(wx.StaticText(self, label="First Name:"), 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) S.Add(self.fname_text, flag=wx.EXPAND) S.Add(wx.StaticText(self, label="Last Name:"), 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) S.Add(self.lname_text, flag=wx.EXPAND) # Save and Cancel buttons sav_but = wx.Button(self, label="Save Record") sav_but.Bind(wx.EVT_BUTTON, self.onSave) can_but = wx.Button(self, label="Reset Record") can_but.Bind(wx.EVT_BUTTON, self.onCancel) # a sizer for the buttons: but_sizer = wx.BoxSizer(wx.HORIZONTAL) but_sizer.Add((1,1), 1) #stretchable spave to shift buttons right but_sizer.Add(can_but, 0, wx.ALL, 4) but_sizer.Add(sav_but, 0, wx.ALL, 4) #Put the whole thing in another sizer to # layout the buttons... Outer_Sizer = wx.BoxSizer(wx.VERTICAL) Outer_Sizer.Add(S, 0, wx.ALL|wx.EXPAND, 10) Outer_Sizer.Add(but_sizer, 0, wx.EXPAND|wx.RIGHT, 10) self.SetSizerAndFit(Outer_Sizer) self.load_data()
def __init__(self, a_entry, *args, **kwargs): """ create a new AddBookForm :param a_entry: a dict for the address book entry """ wx.Panel.__init__(self, *args, **kwargs) self._entry = a_entry ## create text boxes to edit: first name, last name, phone, email. self.fname_text = wx.TextCtrl(self) self.lname_text = wx.TextCtrl(self) self.phone_text = wx.TextCtrl(self) self.email_text = wx.TextCtrl(self) ## use a FlexGridSizer: S = wx.FlexGridSizer(rows=0, cols=2, vgap=8, hgap=8) S.AddGrowableCol(idx=1, proportion=1) S.Add(wx.StaticText(self, label="First Name:"), 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) S.Add(self.fname_text, flag=wx.EXPAND) S.Add(wx.StaticText(self, label="Last Name:"), 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) S.Add(self.lname_text, flag=wx.EXPAND) S.Add(wx.StaticText(self, label="Phone Number:"), 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) S.Add(self.phone_text, flag=wx.EXPAND) S.Add(wx.StaticText(self, label="Email Address:"), 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) S.Add(self.email_text, flag=wx.EXPAND) # Save and Cancel buttons sav_but = wx.Button(self, label="Save Record") sav_but.Bind(wx.EVT_BUTTON, self.onSave) can_but = wx.Button(self, label="Reset Record") can_but.Bind(wx.EVT_BUTTON, self.onCancel) # a sizer for the buttons: but_sizer = wx.BoxSizer(wx.HORIZONTAL) but_sizer.Add((1,1), 1) #stretchable spave to shift buttons right but_sizer.Add(can_but, 0, wx.ALL, 4) but_sizer.Add(sav_but, 0, wx.ALL, 4) #Put the whole thing in another sizer to # layout the buttons... Outer_Sizer = wx.BoxSizer(wx.VERTICAL) Outer_Sizer.Add(S, 0, wx.ALL|wx.EXPAND, 10) Outer_Sizer.Add(but_sizer, 0, wx.EXPAND|wx.RIGHT, 10) self.SetSizerAndFit(Outer_Sizer) self.load_data()