Python wx.ALIGN_CENTER Examples
The following are 30
code examples of wx.ALIGN_CENTER().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
wx
, or try the search function
.
Example #1
Source File: misc.py From trelby with GNU General Public License v2.0 | 7 votes |
def __init__(self, parent, text, title): wx.Dialog.__init__(self, parent, -1, title, style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) vsizer = wx.BoxSizer(wx.VERTICAL) tc = wx.TextCtrl(self, -1, size = wx.Size(400, 200), style = wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_LINEWRAP) tc.SetValue(text) vsizer.Add(tc, 1, wx.EXPAND); vsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) okBtn = gutil.createStockButton(self, "OK") vsizer.Add(okBtn, 0, wx.ALIGN_CENTER) util.finishWindow(self, vsizer) wx.EVT_BUTTON(self, okBtn.GetId(), self.OnOK) okBtn.SetFocus()
Example #2
Source File: bug188_included_toolbar.py From wxGlade with MIT License | 6 votes |
def __init__(self, *args, **kwds): # begin wxGlade: MyFrame.__init__ kwds["style"] = kwds.get("style", 0) wx.Frame.__init__(self, *args, **kwds) self.SetSize((200, 200)) self.SetTitle("frame_1") # Tool Bar self.frame_1_toolbar = wx.ToolBar(self, -1) self.frame_1_toolbar.AddLabelTool(wx.ID_UP, "UpDown", wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_OTHER, (32, 32)), wx.ArtProvider.GetBitmap(wx.ART_GO_DOWN, wx.ART_OTHER, (32, 32)), wx.ITEM_CHECK, "Up or Down", "Up or Down") self.SetToolBar(self.frame_1_toolbar) self.frame_1_toolbar.Realize() # Tool Bar end sizer_1 = wx.BoxSizer(wx.VERTICAL) self.label_1 = wx.StaticText(self, wx.ID_ANY, "placeholder - every design\nneeds a toplevel window", style=wx.ALIGN_CENTER) sizer_1.Add(self.label_1, 1, wx.ALL | wx.EXPAND, 0) self.SetSizer(sizer_1) self.Layout() # end wxGlade # end of class MyFrame
Example #3
Source File: bug188_standalone_toolbar.py From wxGlade with MIT License | 6 votes |
def __init__(self, *args, **kwds): # begin wxGlade: MyFrame.__init__ kwds["style"] = kwds.get("style", 0) wx.Frame.__init__(self, *args, **kwds) self.SetSize((200, 200)) self.SetTitle("frame_1") sizer_1 = wx.BoxSizer(wx.VERTICAL) self.label_1 = wx.StaticText(self, wx.ID_ANY, "placeholder - every design\nneeds a toplevel window", style=wx.ALIGN_CENTER) sizer_1.Add(self.label_1, 1, wx.ALL | wx.EXPAND, 0) self.SetSizer(sizer_1) self.Layout() # end wxGlade # end of class MyFrame
Example #4
Source File: bug188_included_toolbar_Phoenix.py From wxGlade with MIT License | 6 votes |
def __init__(self, *args, **kwds): # begin wxGlade: MyFrame.__init__ kwds["style"] = kwds.get("style", 0) wx.Frame.__init__(self, *args, **kwds) self.SetSize((200, 200)) self.SetTitle("frame_1") # Tool Bar self.frame_1_toolbar = wx.ToolBar(self, -1) self.frame_1_toolbar.AddTool(wx.ID_UP, "UpDown", wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_OTHER, (32, 32)), wx.ArtProvider.GetBitmap(wx.ART_GO_DOWN, wx.ART_OTHER, (32, 32)), wx.ITEM_CHECK, "Up or Down", "Up or Down") self.SetToolBar(self.frame_1_toolbar) self.frame_1_toolbar.Realize() # Tool Bar end sizer_1 = wx.BoxSizer(wx.VERTICAL) self.label_1 = wx.StaticText(self, wx.ID_ANY, "placeholder - every design\nneeds a toplevel window", style=wx.ALIGN_CENTER) sizer_1.Add(self.label_1, 1, wx.ALL | wx.EXPAND, 0) self.SetSizer(sizer_1) self.Layout() # end wxGlade # end of class MyFrame
Example #5
Source File: edit_sizers.py From wxGlade with MIT License | 6 votes |
def __init__(self, parent, title): wx.Dialog.__init__(self, parent, -1, title) self.sizer = sizer = wx.BoxSizer(wx.VERTICAL) self.message = wx.StaticText(self, -1, "") sizer.Add(self.message, 0, wx.TOP | wx.LEFT | wx.RIGHT | wx.EXPAND, 10) self.choices = wx.CheckListBox(self, -1, choices=[]) sizer.Add(self.choices, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 10) sizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.ALL, 10) sz2 = wx.BoxSizer(wx.HORIZONTAL) sz2.Add(wx.Button(self, wx.ID_OK, ""), 0, wx.ALL, 10) sz2.Add(wx.Button(self, wx.ID_CANCEL, ""), 0, wx.ALL, 10) sizer.Add(sz2, 0, wx.ALIGN_CENTER) self.SetAutoLayout(True) self.SetSizer(sizer) sizer.Fit(self) self.CenterOnScreen()
Example #6
Source File: optionsframe.py From youtube-dl-gui with The Unlicense | 6 votes |
def _build_filesize_sizer(self): filesize_box_sizer = wx.StaticBoxSizer(self.filesize_box, wx.VERTICAL) border = wx.GridBagSizer(5, 20) border.Add(self.filesize_max_label, (0, 0), (1, 2), wx.ALIGN_CENTER_HORIZONTAL) border.Add(self.filesize_max_spinctrl, (1, 0)) border.Add(self.filesize_max_sizeunit_combobox, (1, 1)) border.Add(self.filesize_min_label, (2, 0), (1, 2), wx.ALIGN_CENTER_HORIZONTAL) border.Add(self.filesize_min_spinctrl, (3, 0)) border.Add(self.filesize_min_sizeunit_combobox, (3, 1)) filesize_box_sizer.Add(border, flag=wx.ALIGN_CENTER) return filesize_box_sizer
Example #7
Source File: optionsframe.py From youtube-dl-gui with The Unlicense | 6 votes |
def _build_playlist_sizer(self): playlist_box_sizer = wx.StaticBoxSizer(self.playlist_box, wx.VERTICAL) playlist_box_sizer.AddSpacer((-1, 10)) border = wx.GridBagSizer(5, 40) border.Add(self.playlist_start_label, (0, 0), flag=wx.ALIGN_CENTER_VERTICAL) border.Add(self.playlist_start_spinctrl, (0, 1)) border.Add(self.playlist_stop_label, (1, 0), flag=wx.ALIGN_CENTER_VERTICAL) border.Add(self.playlist_stop_spinctrl, (1, 1)) border.Add(self.playlist_max_label, (2, 0), flag=wx.ALIGN_CENTER_VERTICAL) border.Add(self.playlist_max_spinctrl, (2, 1)) playlist_box_sizer.Add(border, flag=wx.ALIGN_CENTER) return playlist_box_sizer
Example #8
Source File: bomsaway.py From Boms-Away with GNU General Public License v3.0 | 6 votes |
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) self.Show(True)
Example #9
Source File: tydesk.py From tydesk with GNU General Public License v3.0 | 6 votes |
def InitUI(self): pnl = wx.Panel(self) vbox = wx.BoxSizer(wx.VERTICAL) sb = wx.StaticBox(pnl, label=u'请输入员工号') sbs = wx.StaticBoxSizer(sb, orient=wx.VERTICAL) self.tcCheckin = wx.TextCtrl(pnl) sbs.Add(self.tcCheckin, 0, wx.ALL|wx.EXPAND, 5) pnl.SetSizer(sbs) hbox2 = wx.BoxSizer(wx.HORIZONTAL) okButton = wx.Button(self, label=u'确认') closeButton = wx.Button(self, label=u'取消') hbox2.Add(okButton) hbox2.Add(closeButton, flag=wx.LEFT, border=5) vbox.Add(pnl, 0, wx.ALL|wx.EXPAND, 5) vbox.Add(hbox2, 0, wx.ALIGN_CENTER|wx.TOP|wx.BOTTOM, 10) self.SetSizer(vbox) self.Layout() okButton.Bind(wx.EVT_BUTTON, self.OnConfirm) closeButton.Bind(wx.EVT_BUTTON, self.OnClose)
Example #10
Source File: tydesk.py From tydesk with GNU General Public License v3.0 | 6 votes |
def Notify(self): if hasattr(self, 'TotalMsgs') and self.TotalMsgs > 0: toaster = TB.ToasterBox(self, tbstyle=TB.TB_COMPLEX) toaster.SetPopupSize((200, 120)) toaster.SetPopupPauseTime(4000) toaster.SetPopupPositionByInt(3) toaster.SetPopupBackgroundColour('#F2F5A9') tbpanel = toaster.GetToasterBoxWindow() panel = wx.Panel(tbpanel, -1) sizer = wx.BoxSizer(wx.VERTICAL) sizer.AddSpacer(10) st = wx.StaticText(panel, wx.ID_ANY, label= u'有新消息!') sizer.Add(st, 0, wx.ALIGN_CENTER|wx.ALL, 10) button = wx.Button(panel, wx.ID_ANY, u"点击查看") self.Bind(wx.EVT_BUTTON, self.OnMessages, button) sizer.Add(button, 0, wx.ALIGN_CENTER|wx.ALL, 10) panel.SetSizer(sizer) toaster.AddPanel(panel) wx.CallLater(1000, toaster.Play)
Example #11
Source File: base_dialog.py From Gooey with MIT License | 6 votes |
def __init__(self, parent, pickerClass, pickerGetter, localizedPickerLabel): wx.Dialog.__init__(self, parent, title=localizedPickerLabel) self.SetBackgroundColour('#ffffff') self.ok_button = wx.Button(self, wx.ID_OK, label=_('ok')) self.picker = pickerClass(self, style=Constants.WX_DP_DROPDOWN) self.pickerGetter = pickerGetter vertical_container = wx.BoxSizer(wx.VERTICAL) vertical_container.AddSpacer(10) vertical_container.Add(self.picker, 0, wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER, 15) vertical_container.AddSpacer(10) button_sizer = wx.BoxSizer(wx.HORIZONTAL) button_sizer.AddStretchSpacer(1) button_sizer.Add(self.ok_button, 0) vertical_container.Add(button_sizer, 0, wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER, 15) vertical_container.AddSpacer(20) self.SetSizerAndFit(vertical_container) self.Bind(wx.EVT_BUTTON, self.onOkButton, self.ok_button)
Example #12
Source File: ConfigDialog.py From EventGhost with GNU General Public License v2.0 | 6 votes |
def FinishSetup(self): # Temporary hack to fix button tabulator ordering problems. self.panel.FinishSetup() if self.description: self.CreateHelpPanel() #line = wx.StaticLine(self) #self.mainSizer.Add(line, 0, wx.EXPAND|wx.ALIGN_CENTER) buttonRow = self.buttonRow buttonRow.applyButton.MoveAfterInTabOrder(self.notebook) buttonRow.cancelButton.MoveAfterInTabOrder(self.notebook) buttonRow.okButton.MoveAfterInTabOrder(self.notebook) if buttonRow.testButton: buttonRow.testButton.MoveAfterInTabOrder(self.notebook) # if not self.showLine: # line.Hide() if self.resizable: self.mainSizer.Add(self.buttonRow.sizer, 0, wx.EXPAND, 0) else: self.mainSizer.Add(self.buttonRow.sizer, 0, wx.EXPAND | wx.RIGHT, 10) self.SetSizerAndFit(self.mainSizer) self.Fit() # without the addition Fit(), some dialogs get a bad size self.SetMinSize(self.GetSize()) self.CentreOnParent() self.panel.SetFocus() eg.TaskletDialog.FinishSetup(self)
Example #13
Source File: dfgui.py From PandasDataFrameGUI with MIT License | 6 votes |
def __init__(self, parent, columns, df_list_ctrl): wx.Panel.__init__(self, parent) columns_with_neutral_selection = [''] + list(columns) self.columns = columns self.df_list_ctrl = df_list_ctrl self.figure = Figure(facecolor="white", figsize=(1, 1)) self.axes = self.figure.add_subplot(111) self.canvas = FigureCanvas(self, -1, self.figure) chart_toolbar = NavigationToolbar2Wx(self.canvas) self.combo_box1 = wx.ComboBox(self, choices=columns_with_neutral_selection, style=wx.CB_READONLY) self.Bind(wx.EVT_COMBOBOX, self.on_combo_box_select) row_sizer = wx.BoxSizer(wx.HORIZONTAL) row_sizer.Add(self.combo_box1, 0, wx.ALL | wx.ALIGN_CENTER, 5) row_sizer.Add(chart_toolbar, 0, wx.ALL, 5) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.canvas, 1, flag=wx.EXPAND, border=5) sizer.Add(row_sizer) self.SetSizer(sizer)
Example #14
Source File: bars_wo_parent.py From wxGlade with MIT License | 6 votes |
def __init__(self, *args, **kwds): # begin wxGlade: MyFrame.__init__ kwds["style"] = kwds.get("style", 0) wx.Frame.__init__(self, *args, **kwds) self.SetSize((200, 200)) self.SetTitle("frame_1") sizer_1 = wx.BoxSizer(wx.VERTICAL) self.label_1 = wx.StaticText(self, wx.ID_ANY, "placeholder - every design\nneeds a toplevel window", style=wx.ALIGN_CENTER) sizer_1.Add(self.label_1, 1, wx.ALL | wx.EXPAND, 0) self.SetSizer(sizer_1) self.Layout() # end wxGlade # end of class MyFrame
Example #15
Source File: bug188_standalone_toolbar_Phoenix.py From wxGlade with MIT License | 6 votes |
def __init__(self, *args, **kwds): # begin wxGlade: MyFrame.__init__ kwds["style"] = kwds.get("style", 0) wx.Frame.__init__(self, *args, **kwds) self.SetSize((200, 200)) self.SetTitle("frame_1") sizer_1 = wx.BoxSizer(wx.VERTICAL) self.label_1 = wx.StaticText(self, wx.ID_ANY, "placeholder - every design\nneeds a toplevel window", style=wx.ALIGN_CENTER) sizer_1.Add(self.label_1, 1, wx.ALL | wx.EXPAND, 0) self.SetSizer(sizer_1) self.Layout() # end wxGlade # end of class MyFrame
Example #16
Source File: guiminer.py From poclbm with GNU General Public License v3.0 | 6 votes |
def get_summary_widgets(self, summary_panel): """Return a list of summary widgets suitable for sizer.AddMany.""" self.summary_panel = summary_panel self.summary_name = wx.StaticText(summary_panel, -1, self.name) self.summary_name.Bind(wx.EVT_LEFT_UP, self.show_this_panel) self.summary_status = wx.StaticText(summary_panel, -1, STR_STOPPED) self.summary_shares_accepted = wx.StaticText(summary_panel, -1, "0") self.summary_shares_invalid = wx.StaticText(summary_panel, -1, "0") self.summary_start = wx.Button(summary_panel, -1, self.get_start_stop_state(), style=wx.BU_EXACTFIT) self.summary_start.Bind(wx.EVT_BUTTON, self.toggle_mining) self.summary_autostart = wx.CheckBox(summary_panel, -1) self.summary_autostart.Bind(wx.EVT_CHECKBOX, self.toggle_autostart) self.summary_autostart.SetValue(self.autostart) return [ (self.summary_name, 0, wx.ALIGN_CENTER_HORIZONTAL), (self.summary_status, 0, wx.ALIGN_CENTER_HORIZONTAL, 0), (self.summary_shares_accepted, 0, wx.ALIGN_CENTER_HORIZONTAL, 0), (self.summary_shares_invalid, 0, wx.ALIGN_CENTER_HORIZONTAL, 0), (self.summary_start, 0, wx.ALIGN_CENTER, 0), (self.summary_autostart, 0, wx.ALIGN_CENTER, 0) ]
Example #17
Source File: fourier_demo_wx_sgskip.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
def __init__(self, *args, **kwargs): wx.Frame.__init__(self, *args, **kwargs) panel = wx.Panel(self) # create the GUI elements self.createCanvas(panel) self.createSliders(panel) # place them in a sizer for the Layout sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.canvas, 1, wx.EXPAND) sizer.Add(self.frequencySliderGroup.sizer, 0, wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, border=5) sizer.Add(self.amplitudeSliderGroup.sizer, 0, wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, border=5) panel.SetSizer(sizer)
Example #18
Source File: fourier_demo_wx_sgskip.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
def __init__(self, parent, label, param): self.sliderLabel = wx.StaticText(parent, label=label) self.sliderText = wx.TextCtrl(parent, -1, style=wx.TE_PROCESS_ENTER) self.slider = wx.Slider(parent, -1) # self.slider.SetMax(param.maximum*1000) self.slider.SetRange(0, param.maximum * 1000) self.setKnob(param.value) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(self.sliderLabel, 0, wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, border=2) sizer.Add(self.sliderText, 0, wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, border=2) sizer.Add(self.slider, 1, wx.EXPAND) self.sizer = sizer self.slider.Bind(wx.EVT_SLIDER, self.sliderHandler) self.sliderText.Bind(wx.EVT_TEXT_ENTER, self.sliderTextHandler) self.param = param self.param.attach(self)
Example #19
Source File: import_OpenGL_cube_and_cone.py From Python-GUI-Programming-Cookbook-Second-Edition with MIT License | 6 votes |
def __init__(self, parent): wx.Panel.__init__(self, parent, -1) box = wx.BoxSizer(wx.VERTICAL) box.Add((20, 30)) keys = buttonDefs.keys() for k in keys: text = buttonDefs[k][1] btn = wx.Button(self, k, text) box.Add(btn, 0, wx.ALIGN_CENTER|wx.ALL, 15) self.Bind(wx.EVT_BUTTON, self.OnButton, btn) # put a GLCanvas on the wx.Panel c = CubeCanvas(self) c.SetMinSize((200, 200)) box.Add(c, 0, wx.ALIGN_CENTER|wx.ALL, 15) c = ConeCanvas(self) c.SetMinSize((200, 200)) box.Add(c, 0, wx.ALIGN_CENTER|wx.ALL, 15) self.SetAutoLayout(True) self.SetSizer(box)
Example #20
Source File: developpage.py From magpy with BSD 3-Clause "New" or "Revised" License | 6 votes |
def doLayout(self): boxSizer = wx.BoxSizer(orient=wx.HORIZONTAL) gridSizer = wx.FlexGridSizer(rows=3, cols=2, vgap=10, hgap=10) # Prepare some reusable arguments for calling sizer.Add(): expandOption = dict(flag=wx.EXPAND) noOptions = dict() emptySpace = ((0, 0), noOptions) # Add the controls to the sizers: for control, options in \ [(self.flagLabel, noOptions), emptySpace, (self.flagsRadioBox, noOptions), (self.commentText, expandOption), (self.okButton, dict(flag=wx.ALIGN_CENTER)), (self.closeButton, dict(flag=wx.ALIGN_CENTER))]: gridSizer.Add(control, **options) for control, options in \ [(gridSizer, dict(border=5, flag=wx.ALL))]: boxSizer.Add(control, **options) self.SetSizerAndFit(boxSizer)
Example #21
Source File: WordWrapRenderer.py From bookhub with MIT License | 6 votes |
def DrawTruncatedString(dc, text, bounds, align=wx.ALIGN_LEFT, valign=wx.ALIGN_TOP, ellipse=wx.RIGHT, ellipseChars="..."): """ Draw the given text truncated to the given bounds. bounds must be a wx.Rect or a 4-element collection: (left, top, width, height). If allowClipping is True, this method changes the clipping region so that no text is drawn outside of the given bounds. """ if not text: return if align == wx.ALIGN_CENTER: align = wx.ALIGN_CENTER_HORIZONTAL if valign == wx.ALIGN_CENTER: valign = wx.ALIGN_CENTER_VERTICAL try: bounds = wx.Rect(*bounds) except: pass lines = WordWrapRenderer._Truncate(dc, text, bounds[2], ellipse, ellipseChars) dc.DrawLabel(lines, bounds, align|valign)
Example #22
Source File: dialog.py From wxGlade with MIT License | 5 votes |
def __init__(self, *args, **kwds): # begin wxGlade: MyDialog.__init__ kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_DIALOG_STYLE wx.Dialog.__init__(self, *args, **kwds) self.SetTitle("dialog") sizer_1 = wx.BoxSizer(wx.VERTICAL) static_text_1 = wx.StaticText(self, wx.ID_ANY, "Enter text:") sizer_1.Add(static_text_1, 0, wx.ALL, 8) self.text_ctrl_1 = wx.TextCtrl(self, wx.ID_ANY, "") sizer_1.Add(self.text_ctrl_1, 0, wx.ALL | wx.EXPAND, 8) sizer_1.Add((20, 20), 1, wx.ALIGN_CENTER | wx.EXPAND, 0) sizer_2 = wx.BoxSizer(wx.HORIZONTAL) sizer_1.Add(sizer_2, 0, wx.ALIGN_RIGHT | wx.ALL, 8) self.button_1 = wx.Button(self, wx.ID_CANCEL, "") sizer_2.Add(self.button_1, 0, 0, 0) self.button_2 = wx.Button(self, wx.ID_OK, "") self.button_2.SetDefault() sizer_2.Add(self.button_2, 0, 0, 0) self.SetSizer(sizer_1) sizer_1.Fit(self) self.Layout() # end wxGlade # end of class MyDialog
Example #23
Source File: new_properties.py From wxGlade with MIT License | 5 votes |
def create_additional_controls(self, panel, sizer, hsizer): # used e.g. by DialogProperty to create the button self.button = wx.Button(panel, -1, " ... ", size=(40,-1)) self.button.Bind(wx.EVT_BUTTON, self.display_dialog) hsizer.Add(self.button, 0, wx.ALL | wx.ALIGN_CENTER, 3) self._update_button() return [self.button]
Example #24
Source File: new_properties.py From wxGlade with MIT License | 5 votes |
def create_editor(self, panel, sizer): if not _is_gridbag(self.owner.parent): return max_rows, max_cols = self.owner.parent.check_span_range(self.owner.index, *self.value) hsizer = wx.BoxSizer(wx.HORIZONTAL) # label self.label_ctrl = label = self._get_label(self._find_label(), panel) hsizer.Add(label, 0, wx.ALL | wx.ALIGN_CENTER, 3) # checkbox, if applicable self.enabler = None style = wx.TE_PROCESS_ENTER | wx.SP_ARROW_KEYS self.rowspin = wx.SpinCtrl( panel, -1, style=style, min=1, max=max_rows) # don't set size here as the self.colspin = wx.SpinCtrl( panel, -1, style=style, min=1, max=max_cols) # combination withe SetSelection fails val = self.value self.rowspin.SetValue(val and val[0] or 1) self.colspin.SetValue(val and val[1] or 1) self.rowspin.Enable(max_rows!=1) self.colspin.Enable(max_cols!=1) self.rowspin.SetSelection(-1, -1) self.colspin.SetSelection(-1, -1) # layout of the controls / sizers; when adding the spins, set min size as well hsizer.Add(wx.StaticText(panel, -1, _("Rows:")), 1, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 3) si = hsizer.Add(self.rowspin, 5, wx.ALL | wx.ALIGN_CENTER, 3).SetMinSize( (30,-1) ) hsizer.Add(wx.StaticText(panel, -1, _("Cols:")), 1, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 3) hsizer.Add(self.colspin, 5, wx.ALL | wx.ALIGN_CENTER, 3).SetMinSize( (30,-1) ) sizer.Add(hsizer, 0, wx.EXPAND) self._set_tooltip(label, self.rowspin, self.colspin) self.rowspin.Bind(wx.EVT_KILL_FOCUS, self.on_kill_focus) # by default, the value is only set when the focus is lost self.colspin.Bind(wx.EVT_KILL_FOCUS, self.on_kill_focus) self.rowspin.Bind(wx.EVT_SET_FOCUS, self.on_focus) self.colspin.Bind(wx.EVT_SET_FOCUS, self.on_focus) if self.immediate: self.rowspin.Bind(wx.EVT_SPINCTRL, self.on_spin) self.rowspin.Bind(wx.EVT_TEXT_ENTER, self.on_spin) # we want the enter key (see style above) self.colspin.Bind(wx.EVT_SPINCTRL, self.on_spin) self.colspin.Bind(wx.EVT_TEXT_ENTER, self.on_spin) self.editing = True
Example #25
Source File: new_properties.py From wxGlade with MIT License | 5 votes |
def create_editor(self, panel, sizer): if self.val_range is None: self.val_range = (0, 1000) hsizer = wx.BoxSizer(wx.HORIZONTAL) # label label_text = self._find_label() label = self.label_ctrl = self._get_label(label_text, panel) hsizer.Add(label, 0, wx.ALL | wx.ALIGN_CENTER, 3) # checkbox, if applicable self.enabler = None if self.deactivated is not None: self.enabler = wx.CheckBox(panel, -1, '') if config.preferences.use_checkboxes_workaround: size = self.enabler.GetSize() self.enabler.SetLabel("Enable %s"%label_text) self.enabler.SetMaxSize(size) self.enabler.SetValue(not self.deactivated) self.enabler.Bind( wx.EVT_CHECKBOX, lambda event: self.toggle_active(event.IsChecked()) ) hsizer.Add(self.enabler, 0, wx.ALIGN_CENTER_VERTICAL|wx.LEFT, 3) self.spin = self.create_spin_ctrl(panel) if self.deactivated is not None: self.spin.Enable(not self.deactivated) elif self.blocked or self.readonly: self.spin.Enable(False) # layout of the controls / sizers hsizer.Add(self.spin, 5, wx.ALL | wx.ALIGN_CENTER, 3) sizer.Add(hsizer, 0, wx.EXPAND) self._set_tooltip(label, self.spin, self.enabler) self.spin.Bind(wx.EVT_KILL_FOCUS, self.on_kill_focus) # by default, the value is only set when the focus is lost self.spin.Bind(wx.EVT_SET_FOCUS, self.on_focus) if wx.Platform == '__WXMAC__' or self.immediate: self.spin.Bind(wx.EVT_SPINCTRL, self.on_spin) self.spin.Bind(wx.EVT_TEXT_ENTER, self.on_spin) # we want the enter key (see style above) self.editing = True
Example #26
Source File: simplebook.py From wxGlade with MIT License | 5 votes |
def __init__(self, *args, **kwds): # begin wxGlade: MySimplebook.__init__ kwds["style"] = kwds.get("style", 0) | wx.NB_TOP wx.Simplebook.__init__(self, *args, **kwds) self.notebook_1_pane_1 = wx.Panel(self, wx.ID_ANY) self.AddPage(self.notebook_1_pane_1, "notebook_1_pane_1") sizer_2 = wx.BoxSizer(wx.VERTICAL) label_1 = wx.StaticText(self.notebook_1_pane_1, wx.ID_ANY, "Page 1 of Simplebook") label_1.SetFont(wx.Font(20, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, 0, "")) sizer_2.Add(label_1, 0, wx.ALIGN_CENTER | wx.ALL, 20) self.button_1 = wx.Button(self.notebook_1_pane_1, wx.ID_ANY, "Show page 2") self.button_1.SetFont(wx.Font(16, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, 0, "")) sizer_2.Add(self.button_1, 1, wx.ALL | wx.EXPAND, 20) self.notebook_1_notebook_1_pane_2 = wx.Panel(self, wx.ID_ANY) self.AddPage(self.notebook_1_notebook_1_pane_2, "notebook_1_pane_2") sizer_3 = wx.BoxSizer(wx.VERTICAL) label_2 = wx.StaticText(self.notebook_1_notebook_1_pane_2, wx.ID_ANY, "Page 2 of Simplebook") label_2.SetFont(wx.Font(20, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, 0, "")) sizer_3.Add(label_2, 0, wx.ALIGN_CENTER | wx.ALL, 20) self.button_2 = wx.Button(self.notebook_1_notebook_1_pane_2, wx.ID_ANY, "Show page 1") self.button_2.SetFont(wx.Font(16, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, 0, "")) sizer_3.Add(self.button_2, 1, wx.ALL | wx.EXPAND, 20) self.notebook_1_notebook_1_pane_2.SetSizer(sizer_3) self.notebook_1_pane_1.SetSizer(sizer_2) self.Bind(wx.EVT_BUTTON, lambda event: self.ChangeSelection(1), self.button_1) self.Bind(wx.EVT_BUTTON, lambda event: self.ChangeSelection(0), self.button_2) # end wxGlade # end of class MySimplebook
Example #27
Source File: viewer_low_level_util.py From dials with BSD 3-Clause "New" or "Revised" License | 5 votes |
def set_scroll_content(self): self.img_lst_v_sizer.Clear(True) for lst_1d in self.lst_2d_bmp: img_lst_hor_sizer = wx.BoxSizer(wx.HORIZONTAL) for i, i_bmp in enumerate(lst_1d): local_bitmap = wx.StaticBitmap(self, bitmap=i_bmp) if self.parent_panel.local_bbox is None: slice_string = "Slice[" + str(i) + ":" + str(i + 1) + ", :, :]" else: bbx = self.parent_panel.local_bbox slice_string = "Image # " + str(bbx[4] + i) slice_sub_info_txt = wx.StaticText(self, -1, slice_string) sigle_slice_sizer = wx.BoxSizer(wx.VERTICAL) sigle_slice_sizer.Clear(True) sigle_slice_sizer.Add( local_bitmap, proportion=0, flag=wx.ALIGN_CENTRE | wx.ALL, border=2 ) sigle_slice_sizer.Add( slice_sub_info_txt, proportion=0, flag=wx.ALIGN_CENTRE | wx.ALL, border=2, ) img_lst_hor_sizer.Add( sigle_slice_sizer, proportion=0, flag=wx.ALIGN_CENTER | wx.ALL, border=2, ) self.img_lst_v_sizer.Add(img_lst_hor_sizer, 0, wx.CENTER | wx.ALL, 10) self.n_img += 1 self.parent_panel.Pframe.Layout() self.SetScrollRate(1, 1)
Example #28
Source File: ConfTreeNodeEditor.py From OpenPLC_Editor with GNU General Public License v3.0 | 5 votes |
def GenerateMethodButtonSizer(self): normal_bt_font = wx.Font(faces["size"] // 3, wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName=faces["helv"]) mouseover_bt_font = wx.Font(faces["size"] // 3, wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName=faces["helv"], underline=True) msizer = wx.BoxSizer(wx.HORIZONTAL) for confnode_method in self.Controler.ConfNodeMethods: if "method" in confnode_method and confnode_method.get("shown", True): button = GenBitmapTextButton(self.Editor, bitmap=GetBitmap(confnode_method.get("bitmap", "Unknown")), label=confnode_method["name"], style=wx.NO_BORDER) button.SetFont(normal_bt_font) button.SetToolTipString(confnode_method["tooltip"]) if confnode_method.get("push", False): button.Bind(wx.EVT_LEFT_DOWN, self.GetButtonCallBackFunction(confnode_method["method"], True)) else: button.Bind(wx.EVT_BUTTON, self.GetButtonCallBackFunction(confnode_method["method"]), button) # a fancy underline on mouseover def setFontStyle(b, s): def fn(event): b.SetFont(s) b.Refresh() event.Skip() return fn button.Bind(wx.EVT_ENTER_WINDOW, setFontStyle(button, mouseover_bt_font)) button.Bind(wx.EVT_LEAVE_WINDOW, setFontStyle(button, normal_bt_font)) # hack to force size to mini if not confnode_method.get("enabled", True): button.Disable() msizer.AddWindow(button, flag=wx.ALIGN_CENTER) return msizer
Example #29
Source File: EtherCATManagementEditor.py From OpenPLC_Editor with GNU General Public License v3.0 | 5 votes |
def SetValue(self, parent, reg_monitor_data, low_index, high_index): """ Set the RegMonitorData into the main table. @param parent: RegisterNotebook object @param reg_monitor_data: data @param low_index: the lowest index of the page @param high_index: the highest index of the page """ self.RegMonitorData = reg_monitor_data # set label name and size register_maintable_label = [(0, "Description"), (1, "Dec"), (2, "Hex"), (3, "Char")] for (index, label) in register_maintable_label: self.SetColLabelValue(index, label) self.SetColSize(0, 200) # if reg_monitor_data is 0, it is initialization of register access. if reg_monitor_data == 0: return 0 # set data into UI row = col = 0 for row_index in reg_monitor_data[low_index:high_index]: col = 0 self.SetRowLabelValue(row, row_index[0]) for data_index in range(4): self.SetCellValue(row, col, row_index[data_index+1]) self.SetCellAlignment(row, col, wx.ALIGN_CENTRE, wx.ALIGN_CENTER) self.SetReadOnly(row, col, True) col = col + 1 row = row + 1
Example #30
Source File: EtherCATManagementEditor.py From OpenPLC_Editor with GNU General Public License v3.0 | 5 votes |
def SetValue(self, parent, data): """ Set the data into the subtable. @param parent: RegisterNotebook object @param data: data """ # lset label name and size Register_SubTable_Label = [(0, "Bits"), (1, "Name"), (2, "Value"), (3, "Enum")] for (index, label) in Register_SubTable_Label: self.SetColLabelValue(index, label) self.SetColSize(1, 200) self.SetColSize(3, 200) # set data into table row = col = 0 for rowData in data: col = 0 for element in rowData: self.SetCellValue(row, col, element) self.SetCellAlignment(row, col, wx.ALIGN_CENTRE, wx.ALIGN_CENTER) self.SetReadOnly(row, col, True) col = col + 1 row = row + 1 # ------------------------------------------------------------------------------- # For Master State Panel # -------------------------------------------------------------------------------