我们从Python开源项目中,提取了以下26个代码示例,用于说明如何使用wx.ALIGN_CENTER_HORIZONTAL。
def __init__(self, *args, **kwds): # begin wxGlade: LogicalVolumeDialog.__init__ wx.Dialog.__init__(self, *args, **kwds) self.panel_1 = wx.Panel(self, wx.ID_ANY) self.panel_4 = wx.Panel(self, wx.ID_ANY) self.label_1 = wx.StaticText(self, wx.ID_ANY, _("Select Logical Volume: "), style=wx.ALIGN_CENTER_HORIZONTAL) self.panel_7 = wx.Panel(self, wx.ID_ANY) self.combo_logical_volumes = wx.ComboBox(self, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN) self.panel_8 = wx.Panel(self, wx.ID_ANY) self.panel_3 = wx.Panel(self, wx.ID_ANY) self.panel_5 = wx.Panel(self, wx.ID_ANY) self.button_select = wx.Button(self, wx.ID_OK, _("Select")) self.panel_9 = wx.Panel(self, wx.ID_ANY) self.button_cancel = wx.Button(self, wx.ID_CANCEL, _("Cancel")) self.panel_6 = wx.Panel(self, wx.ID_ANY) self.panel_2 = wx.Panel(self, wx.ID_ANY) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.button_select_click, id=wx.ID_OK) self.Bind(wx.EVT_BUTTON, self.button_cancel_click, id=wx.ID_CANCEL) # end wxGlade self.PopulateVolumes()
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): # begin wxGlade: sms_dialoge.__do_layout sizer_7 = wx.BoxSizer(wx.HORIZONTAL) sizer_29 = wx.BoxSizer(wx.HORIZONTAL) sizer_30 = wx.BoxSizer(wx.VERTICAL) sizer_31 = wx.BoxSizer(wx.HORIZONTAL) grid_sizer_1 = wx.GridSizer(3, 2, 40, 25) grid_sizer_1.Add(self.label_7, 0, wx.ALIGN_CENTER_VERTICAL, 15) grid_sizer_1.Add(self.combo_box_1, 0, 0, 0) grid_sizer_1.Add(self.label_8, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_1.Add(self.text_ctrl_1, 0, wx.ALIGN_CENTER_VERTICAL, 52) grid_sizer_1.Add(self.button_1, 0, wx.RIGHT | wx.ALIGN_CENTER_HORIZONTAL, 30) grid_sizer_1.Add(self.button_2, 0, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_31.Add(grid_sizer_1, 1, 0, 0) sizer_30.Add(sizer_31, 1, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_29.Add(sizer_30, 1, wx.ALIGN_CENTER_VERTICAL, 0) self.panel_5.SetSizer(sizer_29) sizer_7.Add(self.panel_5, 1, wx.EXPAND, 0) self.SetSizer(sizer_7) self.Layout() self.Maximize(True) #self.ShowFullScreen(True) # 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, id, title): wx.Dialog.__init__(self, parent, id, title) self.selection_idx = None self.selection_text = None vbox = wx.BoxSizer(wx.VERTICAL) stline = wx.StaticText( self, 11, 'Duplicate Component values found!' '\n\nPlease select which format to follow:') vbox.Add(stline, 0, wx.ALIGN_CENTER|wx.TOP) self.comp_list = wx.ListBox(self, 331, style=wx.LB_SINGLE) vbox.Add(self.comp_list, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND) self.SetSizer(vbox) self.comp_list.Bind(wx.EVT_LISTBOX_DCLICK, self.on_selection, id=wx.ID_ANY)
def __init__( self, parent ): wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( -1,-1 ), style = wx.TAB_TRAVERSAL ) bSizer111 = wx.BoxSizer( wx.VERTICAL ) self.m_textCtrlDocument = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( -1,-1 ), wx.TE_AUTO_URL|wx.TE_MULTILINE|wx.TE_READONLY ) bSizer111.Add( self.m_textCtrlDocument, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.EXPAND, 5 ) self.SetSizer( bSizer111 ) self.Layout() bSizer111.Fit( self )
def update_current_search_tab(self): sizer = self.current_sizer sizer.Clear(True) sizer.RemoveGrowableRow(0) sizer.RemoveGrowableRow(1) sizer.RemoveGrowableCol(0) sizer.RemoveGrowableCol(2) if( len(self.current_search) == 0 ): sizer.AddGrowableRow(0) sizer.AddGrowableCol(0) sizer.Add(wx.StaticText(parent=self.current_tab,label="There are no search items."),flag=wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL,pos=(0,0)) else: sizer.AddGrowableCol(2) for i in range(len(self.current_search)): if i%2 == 0: not_box = wx.ComboBox(parent=self.current_tab,value=self.current_search[i][0],choices=['','not'],style=wx.CB_READONLY,size=(60,-1),id=i/2) not_box.Bind(wx.EVT_COMBOBOX,self.not_search_item) sizer.Add(not_box,pos=(i,0),flag=wx.ALIGN_LEFT|wx.TOP,border=5) key = self.current_search[i][1] value = self.current_search[i][2] sizer.Add(wx.StaticText(parent=self.current_tab,label=key+" = '"+value+"'"),pos=(i,1),flag=wx.TOP|wx.LEFT|wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL,border=5) removeButton = wx.Button(self.current_tab,label='Remove',id=i/2) removeButton.Bind(wx.EVT_BUTTON,self.remove_search_item) sizer.Add(removeButton,pos=(i,2),flag=wx.ALIGN_RIGHT|wx.TOP,border=5) else: and_or_box = wx.ComboBox(parent=self.current_tab,value=self.current_search[i],choices=['and','or'],style=wx.CB_READONLY,size=(60,-1),id=(i-1)/2) and_or_box.Bind(wx.EVT_COMBOBOX,self.and_or_search_item) sizer.Add(and_or_box,pos=(i,0),flag=wx.ALIGN_LEFT|wx.TOP,border=5) self.current_tab.EnableScrolling(x_scrolling=True,y_scrolling=True) self.current_tab.SetScrollbars(20,20,10,10) self.current_tab.Fit()
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: Institution.__do_layout sizer_1 = wx.BoxSizer(wx.VERTICAL) sizer_2 = wx.BoxSizer(wx.VERTICAL) sizer_3 = wx.BoxSizer(wx.VERTICAL) sizer_4 = wx.BoxSizer(wx.HORIZONTAL) grid_sizer_1 = wx.GridSizer(5, 2, 3, 15) sizer_2.Add(self.label_1, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL)#,wx.LEFT, 110) grid_sizer_1.Add(self.label_2, 0, wx.TOP, 3) grid_sizer_1.Add(self.text_ctrl_5, 0, 0, 0) grid_sizer_1.Add(self.label_4, 0, wx.TOP, 5) grid_sizer_1.Add(self.text_ctrl_6, 0, wx.TOP, 5) grid_sizer_1.Add(self.label_6, 0, wx.TOP, 15) grid_sizer_1.Add(self.text_ctrl_1, 0, wx.TOP, 10) grid_sizer_1.Add(self.label_7, 0, wx.TOP, 25) grid_sizer_1.Add(self.text_ctrl_2, 0, wx.TOP, 20) grid_sizer_1.Add(self.label_8, 0, wx.TOP, 40) grid_sizer_1.Add(self.text_ctrl_3, 0, wx.TOP, 30) sizer_2.Add(grid_sizer_1, 1, wx.ALL | wx.EXPAND, 15) sizer_3.Add(self.button_1, 0, wx.ALIGN_CENTER_HORIZONTAL) sizer_3.Add(self.button_2, 0, wx.ALIGN_CENTER_HORIZONTAL) sizer_4.Add(sizer_3, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.TOP | wx.EXPAND, 20) sizer_2.Add(sizer_4, 1, wx.TOP | wx.EXPAND , 50) sizer_1.Add(sizer_2, 1, wx.TOP | wx.EXPAND, 20) self.SetSizer(sizer_1) self.Layout() self.Centre() # 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: consolidated_report.__do_layout sizer_1 = wx.BoxSizer(wx.HORIZONTAL) sizer_2 = wx.BoxSizer(wx.VERTICAL) sizer_3 = wx.BoxSizer(wx.HORIZONTAL) sizer_5 = wx.BoxSizer(wx.VERTICAL) sizer_4 = wx.BoxSizer(wx.VERTICAL) sizer_6 = wx.BoxSizer(wx.VERTICAL) grid_sizer_2 = wx.GridSizer(2, 4, 5, 5) grid_sizer_1 = wx.GridSizer(4, 1, 0, 10) grid_sizer_1.Add(self.combo_box_1, 0, wx.BOTTOM | wx.ALIGN_CENTER_HORIZONTAL, 10) grid_sizer_1.Add(self.combo_box_2, 0, wx.ALIGN_CENTER_HORIZONTAL, 0) grid_sizer_1.Add(self.combo_box_3, 0, wx.ALIGN_CENTER_HORIZONTAL, 0) grid_sizer_1.Add(self.combo_box_4, 0, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_2.Add(grid_sizer_1, 0, wx.EXPAND, 0) sizer_6.Add(self.label_1, 0, wx.TOP | wx.BOTTOM | wx.ALIGN_CENTER_HORIZONTAL, 10) 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) grid_sizer_2.Add(self.checkbox_4, 0, 0, 0) grid_sizer_2.Add(self.checkbox_5, 0, 0, 0) grid_sizer_2.Add(self.checkbox_6, 0, 0, 0) grid_sizer_2.Add(self.checkbox_7, 0, 0, 0) sizer_6.Add(grid_sizer_2, 0, wx.EXPAND, 0) sizer_6.Add(self.check_list_box_1, 0, wx.EXPAND, 0) sizer_6.Add(self.check_list_box_2, 1, wx.EXPAND, 0) sizer_2.Add(sizer_6, 1, wx.EXPAND, 0) sizer_4.Add(self.button_1, 0, wx.RIGHT | wx.TOP | wx.BOTTOM | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_HORIZONTAL, 10) sizer_3.Add(sizer_4, 1, wx.EXPAND, 0) sizer_5.Add(self.button_2, 0, wx.RIGHT | wx.TOP | wx.BOTTOM | wx.ALIGN_CENTER_HORIZONTAL, 10) sizer_3.Add(sizer_5, 1, wx.EXPAND, 0) sizer_2.Add(sizer_3, 0, wx.EXPAND, 0) self.panel_1.SetSizer(sizer_2) sizer_1.Add(self.panel_1, 1, wx.ALL | wx.EXPAND, 5) self.SetSizer(sizer_1) self.Layout() # 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 __do_layout(self): sizer_1 = wx.BoxSizer(wx.VERTICAL) grid_sizer_1 = wx.GridSizer(1, 4, 0, 0) sizer_1.Add(self.combo_box_1, 0, wx.ALL | wx.EXPAND, 0) grid_sizer_1.Add(self.button_add, 0, wx.ALIGN_CENTER_HORIZONTAL, 0) grid_sizer_1.Add(self.button_delete, 0, wx.ALIGN_CENTER_HORIZONTAL, 0) grid_sizer_1.Add(self.button_edit, 0, wx.ALIGN_CENTER_HORIZONTAL, 0) grid_sizer_1.Add(self.button_set, 0, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_1.Add(grid_sizer_1, 1, 0, 0) self.SetSizer(sizer_1) sizer_1.Fit(self) self.Layout()
def __init__(self, parent, id, title): wx.Dialog.__init__(self, parent, id, title) self.selection_idx = None self.selection_text = None vbox = wx.BoxSizer(wx.VERTICAL) stline = wx.StaticText(self, 11, 'Please select from the following components') vbox.Add(stline, 0, wx.ALIGN_CENTER|wx.TOP) self.comp_list = wx.ListBox(self, 331, style=wx.LB_SINGLE) vbox.Add(self.comp_list, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND) self.SetSizer(vbox) self.comp_list.Bind(wx.EVT_LISTBOX, self.on_selection, id=wx.ID_ANY)
def __init__(self, parent, *args, **kwargs): """ create a new swither instance. :param parent: the parent frame -- this is designed to go on an AddBookFrame object :params *args, **kwargs: all the other arguments that a wx.Window takes. """ print "in __init__" wx.Panel.__init__(self, parent, *args, **kwargs) self.add_book_frame = parent ##Create the buttons to scroll through add_book_frame prev_button = wx.Button(self, label="Previous") prev_button.Bind(wx.EVT_BUTTON, self.onPrev) next_button = wx.Button(self, label="Next") next_button.Bind(wx.EVT_BUTTON, self.onNext) ## use a Sizer to lay it out S = wx.BoxSizer(wx.HORIZONTAL) S.Add(prev_button, 1, wx.ALL, 4) S.Add((10,1),0) S.Add(wx.StaticText(self,label="AddressBook"), 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 4) S.Add((10,1),0) S.Add(next_button, 1,wx.ALL, 4) self.SetSizerAndFit(S)
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 initSliders(self): sliderSizer = wx.BoxSizer(wx.HORIZONTAL) lowFreqControlBox = widgets.ControlBox(self, label='lowFreq', orient=wx.VERTICAL) self.lowFreqText = wx.StaticText(self, label='%6.2f(Hz)' % self.flt.lowFreq) lowFreqTextSizer = wx.BoxSizer(orient=wx.VERTICAL) lowFreqTextSizer.Add(self.lowFreqText, proportion=0, flag=wx.ALIGN_CENTER_HORIZONTAL) self.lowFreqSlider = wx.Slider(self, style=wx.SL_VERTICAL | wx.SL_INVERSE, minValue=0, maxValue=int(self.flt.nyquist*4), value=int(self.flt.lowFreq*4)) self.Bind(wx.EVT_SLIDER, self.setLowFreq, self.lowFreqSlider) lowFreqControlBox.Add(lowFreqTextSizer, proportion=0, flag=wx.TOP | wx.BOTTOM | wx.EXPAND, border=8) lowFreqControlBox.Add(self.lowFreqSlider, proportion=1, flag=wx.LEFT | wx.RIGHT | wx.EXPAND, border=25) sliderSizer.Add(lowFreqControlBox, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) highFreqControlBox = widgets.ControlBox(self, label='highFreq', orient=wx.VERTICAL) self.highFreqText = wx.StaticText(self, label='%6.2f(Hz)' % self.flt.highFreq) highFreqTextSizer = wx.BoxSizer(orient=wx.VERTICAL) highFreqTextSizer.Add(self.highFreqText, proportion=0, flag=wx.ALIGN_CENTER_HORIZONTAL) self.highFreqSlider = wx.Slider(self, style=wx.SL_VERTICAL | wx.SL_INVERSE, minValue=0, maxValue=int(self.flt.nyquist*4), value=int(self.flt.highFreq*4)) self.Bind(wx.EVT_SLIDER, self.setHighFreq, self.highFreqSlider) highFreqControlBox.Add(highFreqTextSizer, proportion=0, flag=wx.TOP | wx.BOTTOM | wx.EXPAND, border=8) highFreqControlBox.Add(self.highFreqSlider, proportion=1, flag=wx.LEFT | wx.RIGHT | wx.EXPAND, border=25) sliderSizer.Add(highFreqControlBox, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) orderControlBox = widgets.ControlBox(self, label='Order', orient=wx.VERTICAL) self.orderText = wx.StaticText(self, label='%2d' % self.flt.order) orderTextSizer = wx.BoxSizer(orient=wx.VERTICAL) orderTextSizer.Add(self.orderText, proportion=0, flag=wx.ALIGN_CENTER_HORIZONTAL) self.orderSlider = wx.Slider(self, style=wx.SL_VERTICAL | wx.SL_INVERSE, minValue=1, maxValue=10, value=self.flt.order) self.Bind(wx.EVT_SLIDER, self.setOrder, self.orderSlider) orderControlBox.Add(orderTextSizer, proportion=0, flag=wx.TOP | wx.BOTTOM | wx.EXPAND, border=8) orderControlBox.Add(self.orderSlider, proportion=1, flag=wx.LEFT | wx.RIGHT | wx.EXPAND, border=25) sliderSizer.Add(orderControlBox, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) self.bottomSizer.Add(sliderSizer, proportion=1, flag=wx.EXPAND)
def initSliders(self): sliderSizer = wx.BoxSizer(wx.HORIZONTAL) lowFreqControlBox = widgets.ControlBox(self, label='lowFreq', orient=wx.VERTICAL) self.lowFreqText = wx.StaticText(self, label='%6.2f(Hz)' % self.flt.lowFreq) lowFreqTextSizer = wx.BoxSizer(orient=wx.VERTICAL) lowFreqTextSizer.Add(self.lowFreqText, proportion=0, flag=wx.ALIGN_CENTER_HORIZONTAL) self.lowFreqSlider = wx.Slider(self, style=wx.SL_VERTICAL | wx.SL_INVERSE, minValue=0, maxValue=int(self.flt.nyquist*4), value=int(self.flt.lowFreq*4)) self.Bind(wx.EVT_SLIDER, self.setLowFreq, self.lowFreqSlider) lowFreqControlBox.Add(lowFreqTextSizer, proportion=0, flag=wx.TOP | wx.BOTTOM | wx.EXPAND, border=8) lowFreqControlBox.Add(self.lowFreqSlider, proportion=1, flag=wx.LEFT | wx.RIGHT | wx.EXPAND, border=25) sliderSizer.Add(lowFreqControlBox, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) highFreqControlBox = widgets.ControlBox(self, label='highFreq', orient=wx.VERTICAL) self.highFreqText = wx.StaticText(self, label='%6.2f(Hz)' % self.flt.highFreq) highFreqTextSizer = wx.BoxSizer(orient=wx.VERTICAL) highFreqTextSizer.Add(self.highFreqText, proportion=0, flag=wx.ALIGN_CENTER_HORIZONTAL) self.highFreqSlider = wx.Slider(self, style=wx.SL_VERTICAL | wx.SL_INVERSE, minValue=0, maxValue=int(self.flt.nyquist*4), value=int(self.flt.highFreq*4)) self.Bind(wx.EVT_SLIDER, self.setHighFreq, self.highFreqSlider) highFreqControlBox.Add(highFreqTextSizer, proportion=0, flag=wx.TOP | wx.BOTTOM | wx.EXPAND, border=8) highFreqControlBox.Add(self.highFreqSlider, proportion=1, flag=wx.LEFT | wx.RIGHT | wx.EXPAND, border=25) sliderSizer.Add(highFreqControlBox, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) orderControlBox = widgets.ControlBox(self, label='Order', orient=wx.VERTICAL) self.orderText = wx.StaticText(self, label='%2d' % self.flt.order) orderTextSizer = wx.BoxSizer(orient=wx.VERTICAL) orderTextSizer.Add(self.orderText, proportion=0, flag=wx.ALIGN_CENTER_HORIZONTAL) self.orderSlider = wx.Slider(self, style=wx.SL_VERTICAL | wx.SL_INVERSE, minValue=2, maxValue=50, value=self.flt.order // 2) self.Bind(wx.EVT_SLIDER, self.setOrder, self.orderSlider) orderControlBox.Add(orderTextSizer, proportion=0, flag=wx.TOP | wx.BOTTOM | wx.EXPAND, border=8) orderControlBox.Add(self.orderSlider, proportion=1, flag=wx.LEFT | wx.RIGHT | wx.EXPAND, border=25) sliderSizer.Add(orderControlBox, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) self.bottomSizer.Add(sliderSizer, proportion=1, flag=wx.EXPAND)
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)