我们从Python开源项目中,提取了以下24个代码示例,用于说明如何使用wx.GridSizer()。
def initChoices(self): choiceControlBox = widgets.ControlBox(self, label='Choices', orient=wx.VERTICAL) choiceGridSizer = wx.GridSizer(1, 2, 10, 10) self.leftChoiceTextCtrl = wx.TextCtrl(parent=self, value=self.pg.choices[0], style=wx.TE_PROCESS_ENTER) self.Bind(wx.EVT_TEXT_ENTER, self.setChoices, self.leftChoiceTextCtrl) self.leftChoiceTextCtrl.Bind(wx.EVT_KILL_FOCUS, self.setChoices, self.leftChoiceTextCtrl) self.offlineControls += [self.leftChoiceTextCtrl] choiceGridSizer.Add(self.leftChoiceTextCtrl, proportion=0, flag=wx.ALL | wx.EXPAND, border=10) self.rightChoiceTextCtrl = wx.TextCtrl(parent=self, value=self.pg.choices[1], style=wx.TE_PROCESS_ENTER) self.Bind(wx.EVT_TEXT_ENTER, self.setChoices, self.rightChoiceTextCtrl) self.rightChoiceTextCtrl.Bind(wx.EVT_KILL_FOCUS, self.setChoices, self.rightChoiceTextCtrl) self.offlineControls += [self.rightChoiceTextCtrl] choiceGridSizer.Add(self.rightChoiceTextCtrl, proportion=0, flag=wx.ALL | wx.EXPAND, border=10) choiceControlBox.Add(choiceGridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=0) self.sizer.Add(choiceControlBox, proportion=0, flag=wx.ALL | wx.EXPAND, border=10)
def __do_layout(self): # begin wxGlade: MyFrame.__do_layout sizer_1 = wx.BoxSizer(wx.VERTICAL) grid_sizer_1 = wx.GridSizer(5, 2, 0, 0) grid_sizer_1.Add(self.label_1, 0, wx.LEFT|wx.TOP, 20) grid_sizer_1.Add(self.combo_box_1, 0, wx.TOP, 20) grid_sizer_1.Add(self.label_2, 0, wx.LEFT|wx.TOP, 20) grid_sizer_1.Add(self.combo_box_2, 0, wx.TOP, 20) grid_sizer_1.Add(self.label_3, 0, wx.LEFT|wx.TOP, 20) grid_sizer_1.Add(self.combo_box_3, 0, wx.RIGHT|wx.TOP, 20) grid_sizer_1.Add(self.label_4, 0, wx.LEFT|wx.TOP|wx.BOTTOM|wx.EXPAND, 20) grid_sizer_1.Add(self.combo_box_4, 0, wx.RIGHT|wx.TOP|wx.BOTTOM, 20) grid_sizer_1.Add(self.button_1, 0, wx.TOP|wx.ALIGN_RIGHT, 0) grid_sizer_1.Add(self.button_2, 0, wx.LEFT, 30) sizer_1.Add(grid_sizer_1, 1, wx.EXPAND, 0) self.SetSizer(sizer_1) self.Layout() self.Centre() # end wxGlade
def __do_layout(self): # begin wxGlade: working_days.__do_layout sizer_1 = wx.BoxSizer(wx.VERTICAL) grid_sizer_1 = wx.GridSizer(4, 2, 10, 10) grid_sizer_1.Add(self.label_1, 0, wx.LEFT, 20) grid_sizer_1.Add(self.combo_box_1, 0, wx.RIGHT, 20) grid_sizer_1.Add(self.label_5, 0, wx.LEFT, 74) grid_sizer_1.Add((0, 0), 0, 0, 0) grid_sizer_1.Add(self.label_2, 0, wx.LEFT | wx.TOP, 7) grid_sizer_1.Add(self.text_ctrl_1, 0, 0, 0) grid_sizer_1.Add(self.label_3, 0, wx.LEFT | wx.TOP, 7) grid_sizer_1.Add(self.text_ctrl_2, 0, 0, 0) grid_sizer_1.Add(self.label_4, 0, wx.LEFT | wx.TOP, 10) grid_sizer_1.Add(self.text_ctrl_3, 0, 0, 0) grid_sizer_1.Add(self.button_1, 0, wx.LEFT, 60) grid_sizer_1.Add(self.button_2, 0, wx.LEFT, 10) sizer_1.Add(grid_sizer_1, 1, wx.ALL | wx.EXPAND, 5) self.SetSizer(sizer_1) self.Layout() self.Centre() # end wxGlade
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: chng_pass.__do_layout sizer_1 = wx.BoxSizer(wx.VERTICAL) sizer_2 = wx.BoxSizer(wx.VERTICAL) sizer_3 = wx.BoxSizer(wx.HORIZONTAL) grid_sizer_1 = wx.GridSizer(4, 2, 0, 0) grid_sizer_1.Add(self.label_3, 0, wx.TOP, 10) grid_sizer_1.Add(self.combo_box_1, 0, 0, 0) grid_sizer_1.Add(self.label_4, 0, wx.TOP, 10) grid_sizer_1.Add(self.text_ctrl_1, 0, 0, 0) grid_sizer_1.Add(self.label_5, 0, wx.TOP, 10) grid_sizer_1.Add(self.text_ctrl_2, 0, 0, 0) grid_sizer_1.Add(self.label_6, 0, wx.TOP, 10) grid_sizer_1.Add(self.text_ctrl_3, 0, 0, 0) sizer_2.Add(grid_sizer_1, 1, wx.EXPAND, 0) sizer_3.Add(self.button_1, 0, wx.LEFT, 80) sizer_3.Add(self.button_2, 0, wx.LEFT, 30) sizer_2.Add(sizer_3, 0, wx.TOP | wx.EXPAND, 20) sizer_1.Add(sizer_2, 1, wx.ALL | wx.EXPAND, 20) self.SetSizer(sizer_1) sizer_1.Fit(self) self.Layout() self.Centre() # end wxGlade
def __do_layout(self): # begin wxGlade: MyFrame.__do_layout sizer_1 = wx.BoxSizer(wx.VERTICAL) grid_sizer_1 = wx.GridSizer(5, 2, 0, 0) grid_sizer_1.Add(self.label_1, 0, wx.LEFT|wx.TOP, 20) grid_sizer_1.Add(self.combo_box_1, 0, wx.TOP, 20) grid_sizer_1.Add(self.label_2, 0, wx.LEFT|wx.TOP, 20) grid_sizer_1.Add(self.combo_box_2, 0, wx.TOP, 20) grid_sizer_1.Add(self.label_3, 0, wx.LEFT|wx.TOP, 20) grid_sizer_1.Add(self.combo_box_3, 0, wx.RIGHT|wx.TOP, 20) #grid_sizer_1.Add(self.button_3, 0, wx.LEFT|wx.TOP|wx.BOTTOM|wx.EXPAND, 20) #grid_sizer_1.Add(self.combo_box_4, 0, wx.RIGHT|wx.TOP|wx.BOTTOM, 20) grid_sizer_1.Add(self.button_1, 0, wx.TOP|wx.ALIGN_RIGHT, 0) grid_sizer_1.Add(self.button_2, 0, wx.LEFT, 30) sizer_1.Add(grid_sizer_1, 1, wx.EXPAND, 0) self.SetSizer(sizer_1) self.Layout() self.Centre()
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 createWidgets(self): sizer = wx.GridSizer(3,3,5,5) self.SIM.gatherInfo() sizer.Add(wx.Size(0,0), 10, 1, wx.LEFT, 10) # Spacer sizer.Add(wxskinStaticText(self, -1, "Activated"), 1, wx.LEFT | wx.RIGHT, 10) sizer.Add(wxskinStaticText(self, -1, "Tries left"), 1, wx.RIGHT, 10) sizer.Add(wxskinStaticText(self, -1, "PIN1"), 1, wx.LEFT, 10) if self.SIM.chv1_enabled: sizer.Add(wx.TextCtrl(self, -1, "Yes", style=wx.TE_READONLY), 1, wx.RIGHT, 10) else: sizer.Add(wx.TextCtrl(self, -1, "No", style=wx.TE_READONLY), 1, wx.RIGHT, 10) sizer.Add(wx.TextCtrl(self, -1, "%d" % self.SIM.chv1_tries_left, style=wx.TE_READONLY), 1, wx.RIGHT, 10) sizer.Add(wxskinStaticText(self, -1, "PIN2"), 1, wx.LEFT, 10) if self.SIM.chv2_enabled: sizer.Add(wx.TextCtrl(self, -1, "Yes", style=wx.TE_READONLY), 1, wx.RIGHT, 10) else: sizer.Add(wx.TextCtrl(self, -1, "No", style=wx.TE_READONLY), 1, wx.RIGHT, 10) sizer.Add(wx.TextCtrl(self, -1, "%d" % self.SIM.chv2_tries_left, style=wx.TE_READONLY), 1, wx.RIGHT, 10) self.SetSizer(sizer) self.SetAutoLayout(1) sizer.Fit(self) sizer.Layout()
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: 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): # begin wxGlade: Institution.__do_layout sizer_1 = wx.BoxSizer(wx.VERTICAL) sizer_2 = wx.BoxSizer(wx.VERTICAL) sizer_3 = wx.BoxSizer(wx.HORIZONTAL) grid_sizer_1 = wx.GridSizer(5, 2, 3, 15) sizer_2.Add(self.label_1, 0, 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.LEFT, 180) sizer_3.Add(self.button_2, 0, wx.LEFT, 40) sizer_2.Add(sizer_3, 1, wx.TOP | wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 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): 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, rows=1, cols=0, vgap=0, hgap=0, size=util.MAX_THUMBNAIL_SIZE): super(MyGridStaticBitmap, self).__init__(parent) self.sizer = wx.GridSizer(rows, cols, vgap, hgap) self.SetSizer(self.sizer) self.size = size
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.GridSizer} else: kwargs['sizer_class'] = wx.GridSizer super(GridSizerContainer, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): wx.Panel.__init__(self, *args, **kwargs) sizer = wx.BoxSizer(wx.VERTICAL) # Main vertical sizer self.display = wx.ComboBox(self) # Current calculation sizer.Add(self.display, 0, wx.EXPAND|wx.BOTTOM, 8) # Add to main sizer # [7][8][9][/] # [4][5][6][*] # [1][2][3][-] # [0][.][C][+] gsizer = wx.GridSizer(4, 4, 8, 8) for row in (("7", "8", "9", "/"), ("4", "5", "6", "*"), ("1", "2", "3", "-"), ("0", ".", "C", "+")): for label in row: b = wx.Button(self, label=label, size=(40,-1)) gsizer.Add(b) b.Bind(wx.EVT_BUTTON, self.OnButton) sizer.Add(gsizer, 1, wx.EXPAND) # [ = ] b = wx.Button(self, label="=") b.Bind(wx.EVT_BUTTON, self.OnButton) sizer.Add(b, 0, wx.EXPAND|wx.ALL, 8) self.equal = b # Set sizer and center self.SetSizerAndFit(sizer)
def initChannelConfig(self): """Initialize the channel configuration area. """ # controlbox to surround the area chanControlBox = widgets.ControlBox(self.scrolledPanel, label='Channels', orient=wx.HORIZONTAL) # only supports two columns, this could probably be done better XXX - idfah ## # left column ## leftChanSizer = wx.BoxSizer(orient=wx.VERTICAL) ## # create text controls ## self.chanTextCtrls = [] ## for c in xrange(16): ## curChanTextCtrl = wx.TextCtrl(self.scrolledPanel) ## self.chanTextCtrls.append(curChanTextCtrl) ## leftChanSizer.Add(curChanTextCtrl, proportion=0, ## flag=wx.RIGHT | wx.TOP | wx.LEFT, border=10) ## # add to sizer ## chanControlBox.Add(leftChanSizer) ## # right column ## rightChanSizer = wx.BoxSizer(orient=wx.VERTICAL) ## # create text controls ## for c in xrange(16): ## curChanTextCtrl = wx.TextCtrl(self.scrolledPanel) ## self.chanTextCtrls.append(curChanTextCtrl) ## rightChanSizer.Add(curChanTextCtrl, proportion=0, ## flag=wx.RIGHT | wx.TOP | wx.LEFT, border=10) ## # add to sizer ## chanControlBox.Add(rightChanSizer) self.chanSizer = wx.GridSizer(40, 2, 10, 10) #self.chanSizer = wx.BoxSizer(orient=wx.VERTICAL) self.chanTextCtrls = [wx.TextCtrl(self.scrolledPanel) for i in xrange(40*2)] self.chanSizer.AddMany(self.chanTextCtrls) #for ctc in self.chanTextCtrls: # self.chanSizer.Add(ctc, proportion=0, flag=wx.TOP | wx.LEFT | wx.RIGHT, border=2) chanControlBox.Add(self.chanSizer, flag=wx.ALL, border=10) # sizer for channel configuration area self.chanSizer = wx.BoxSizer(orient=wx.VERTICAL) self.chanSizer.Add(chanControlBox, proportion=1, flag=wx.TOP | wx.BOTTOM, border=10)
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 )