Python wx.EVT_BUTTON Examples
The following are 30
code examples of wx.EVT_BUTTON().
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: backend_wx.py From Mastering-Elasticsearch-7.0 with MIT License | 7 votes |
def __init__(self, parent, help_entries): wx.Dialog.__init__(self, parent, title="Help", style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) sizer = wx.BoxSizer(wx.VERTICAL) grid_sizer = wx.FlexGridSizer(0, 3, 8, 6) # create and add the entries bold = self.GetFont().MakeBold() for r, row in enumerate(self.headers + help_entries): for (col, width) in zip(row, self.widths): label = wx.StaticText(self, label=col) if r == 0: label.SetFont(bold) label.Wrap(width) grid_sizer.Add(label, 0, 0, 0) # finalize layout, create button sizer.Add(grid_sizer, 0, wx.ALL, 6) OK = wx.Button(self, wx.ID_OK) sizer.Add(OK, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 8) self.SetSizer(sizer) sizer.Fit(self) self.Layout() self.Bind(wx.EVT_CLOSE, self.OnClose) OK.Bind(wx.EVT_BUTTON, self.OnClose)
Example #3
Source File: calender_dialog.py From pyFileFixity with MIT License | 6 votes |
def __init__(self, parent): wx.Dialog.__init__(self, parent) self.SetBackgroundColour('#ffffff') self.ok_button = wx.Button(self, label='Ok') self.datepicker = wx.DatePickerCtrl(self, style=wx.DP_DROPDOWN) vertical_container = wx.BoxSizer(wx.VERTICAL) vertical_container.AddSpacer(10) vertical_container.Add(wx_util.h1(self, label='Select a Date'), 0, wx.LEFT | wx.RIGHT, 15) vertical_container.AddSpacer(10) vertical_container.Add(self.datepicker, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 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, 15) vertical_container.AddSpacer(20) self.SetSizerAndFit(vertical_container) self.Bind(wx.EVT_BUTTON, self.OnOkButton, self.ok_button)
Example #4
Source File: charmapdlg.py From trelby with GNU General Public License v2.0 | 6 votes |
def __init__(self, parent, ctrl): wx.Dialog.__init__(self, parent, -1, "Character map") self.ctrl = ctrl hsizer = wx.BoxSizer(wx.HORIZONTAL) self.charMap = MyCharMap(self) hsizer.Add(self.charMap) self.insertButton = wx.Button(self, -1, " Insert character ") hsizer.Add(self.insertButton, 0, wx.ALL, 10) wx.EVT_BUTTON(self, self.insertButton.GetId(), self.OnInsert) gutil.btnDblClick(self.insertButton, self.OnInsert) util.finishWindow(self, hsizer, 0)
Example #5
Source File: footer.py From me-ica with GNU Lesser General Public License v2.1 | 6 votes |
def __init__(self, parent, **kwargs): wx.Panel.__init__(self, parent, **kwargs) self.SetMinSize((30, 53)) # components self.cancel_button = None self.start_button = None self.progress_bar = None self.close_button = None self.stop_button = None self.restart_button = None self.buttons = None self.layouts = {} self._init_components() self._do_layout() for button in self.buttons: self.Bind(wx.EVT_BUTTON, self.dispatch_click, button)
Example #6
Source File: dialogs.py From NVDARemote with GNU General Public License v2.0 | 6 votes |
def __init__(self, parent=None, id=wx.ID_ANY): super().__init__(parent, id) sizer = wx.BoxSizer(wx.HORIZONTAL) # Translators: The label of an edit field in connect dialog to enter name or address of the remote computer. sizer.Add(wx.StaticText(self, wx.ID_ANY, label=_("&Host:"))) self.host = wx.TextCtrl(self, wx.ID_ANY) sizer.Add(self.host) # Translators: Label of the edit field to enter key (password) to secure the remote connection. sizer.Add(wx.StaticText(self, wx.ID_ANY, label=_("&Key:"))) self.key = wx.TextCtrl(self, wx.ID_ANY) sizer.Add(self.key) # Translators: The button used to generate a random key/password. self.generate_key = wx.Button(parent=self, label=_("&Generate Key")) self.generate_key.Bind(wx.EVT_BUTTON, self.on_generate_key) sizer.Add(self.generate_key) self.SetSizerAndFit(sizer)
Example #7
Source File: widget_pack.py From me-ica with GNU Lesser General Public License v2.1 | 6 votes |
def build(self, parent, data, choices=None): self.parent = parent self.widget = wx.TextCtrl(self.parent) self.widget.AppendText('') self.widget.SetMinSize((0, -1)) dt = FileDrop(self.widget) self.widget.SetDropTarget(dt) self.button = wx.Button(self.parent, label=self.button_text, size=(73, 23)) widget_sizer = wx.BoxSizer(wx.HORIZONTAL) widget_sizer.Add(self.widget, 1, wx.EXPAND) widget_sizer.AddSpacer(10) widget_sizer.Add(self.button, 0, wx.ALIGN_CENTER_VERTICAL) parent.Bind(wx.EVT_BUTTON, self.on_button, self.button) return widget_sizer
Example #8
Source File: gutil.py From trelby with GNU General Public License v2.0 | 6 votes |
def createStockButton(parent, label): # wxMSW does not really have them: it does not have any icons and it # inconsistently adds the shortcut key to some buttons, but not to # all, so it's better not to use them at all on Windows. if misc.isUnix: ids = { "OK" : wx.ID_OK, "Cancel" : wx.ID_CANCEL, "Apply" : wx.ID_APPLY, "Add" : wx.ID_ADD, "Delete" : wx.ID_DELETE, "Preview" : wx.ID_PREVIEW } return wx.Button(parent, ids[label]) else: return wx.Button(parent, -1, label) # wxWidgets has a bug in 2.6 on wxGTK2 where double clicking on a button # does not send two wx.EVT_BUTTON events, only one. since the wxWidgets # maintainers do not seem interested in fixing this # (http://sourceforge.net/tracker/index.php?func=detail&aid=1449838&group_id=9863&atid=109863), # we work around it ourselves by binding the left mouse button double # click event to the same callback function on the buggy platforms.
Example #9
Source File: calender_dialog.py From me-ica with GNU Lesser General Public License v2.1 | 6 votes |
def __init__(self, parent): wx.Dialog.__init__(self, parent) self.SetBackgroundColour('#ffffff') self.ok_button = wx.Button(self, wx.ID_OK, label='Ok') self.datepicker = wx.DatePickerCtrl(self, style=wx.DP_DROPDOWN) vertical_container = wx.BoxSizer(wx.VERTICAL) vertical_container.AddSpacer(10) vertical_container.Add(wx_util.h1(self, label='Select a Date'), 0, wx.LEFT | wx.RIGHT, 15) vertical_container.AddSpacer(10) vertical_container.Add(self.datepicker, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 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, 15) vertical_container.AddSpacer(20) self.SetSizerAndFit(vertical_container) self.Bind(wx.EVT_BUTTON, self.OnOkButton, self.ok_button)
Example #10
Source File: dialogs.py From NVDARemote with GNU General Public License v2.0 | 6 votes |
def __init__(self, parent=None, id=wx.ID_ANY): super().__init__(parent, id) sizer = wx.BoxSizer(wx.HORIZONTAL) # Translators: Used in server mode to obtain the external IP address for the server (controlled computer) for direct connection. self.get_IP = wx.Button(parent=self, label=_("Get External &IP")) self.get_IP.Bind(wx.EVT_BUTTON, self.on_get_IP) sizer.Add(self.get_IP) # Translators: Label of the field displaying the external IP address if using direct (client to server) connection. sizer.Add(wx.StaticText(self, wx.ID_ANY, label=_("&External IP:"))) self.external_IP = wx.TextCtrl(self, wx.ID_ANY, style=wx.TE_READONLY|wx.TE_MULTILINE) sizer.Add(self.external_IP) # Translators: The label of an edit field in connect dialog to enter the port the server will listen on. sizer.Add(wx.StaticText(self, wx.ID_ANY, label=_("&Port:"))) self.port = wx.TextCtrl(self, wx.ID_ANY, value=str(socket_utils.SERVER_PORT)) sizer.Add(self.port) sizer.Add(wx.StaticText(self, wx.ID_ANY, label=_("&Key:"))) self.key = wx.TextCtrl(self, wx.ID_ANY) sizer.Add(self.key) self.generate_key = wx.Button(parent=self, label=_("&Generate Key")) self.generate_key.Bind(wx.EVT_BUTTON, self.on_generate_key) sizer.Add(self.generate_key) self.SetSizerAndFit(sizer)
Example #11
Source File: dialogs.py From NVDARemote with GNU General Public License v2.0 | 6 votes |
def __init__(self, parent, id, title): super().__init__(parent, id, title=title) main_sizer = self.main_sizer = wx.BoxSizer(wx.VERTICAL) self.client_or_server = wx.RadioBox(self, wx.ID_ANY, choices=(_("Client"), _("Server")), style=wx.RA_VERTICAL) self.client_or_server.Bind(wx.EVT_RADIOBOX, self.on_client_or_server) self.client_or_server.SetSelection(0) main_sizer.Add(self.client_or_server) choices = [_("Control another machine"), _("Allow this machine to be controlled")] self.connection_type = wx.RadioBox(self, wx.ID_ANY, choices=choices, style=wx.RA_VERTICAL) self.connection_type.SetSelection(0) main_sizer.Add(self.connection_type) self.container = wx.Panel(parent=self) self.panel = ClientPanel(parent=self.container) main_sizer.Add(self.container) buttons = self.CreateButtonSizer(wx.OK | wx.CANCEL) main_sizer.Add(buttons, flag=wx.BOTTOM) main_sizer.Fit(self) self.SetSizer(main_sizer) self.Center(wx.BOTH | WX_CENTER) ok = wx.FindWindowById(wx.ID_OK, self) ok.Bind(wx.EVT_BUTTON, self.on_ok)
Example #12
Source File: core.py From wafer_map with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent, id=-1, colour=wx.BLACK, pos=wx.DefaultPosition, size=wx.DefaultSize, style = CLRP_DEFAULT_STYLE, validator = wx.DefaultValidator, name = "colourpickerwidget"): wx.BitmapButton.__init__(self, parent, id, wx.Bitmap(1,1), pos, size, style, validator, name) self.SetColour(colour) self.InvalidateBestSize() self.SetInitialSize(size) self.Bind(wx.EVT_BUTTON, self.OnButtonClick) global _colourData if _colourData is None: _colourData = wx.ColourData() _colourData.SetChooseFull(True) grey = 0 for i in range(16): c = wx.Colour(grey, grey, grey) _colourData.SetCustomColour(i, c) grey += 16
Example #13
Source File: backend_wx.py From Computable with MIT License | 6 votes |
def __init__(self, parent): wx.Button.__init__(self, parent, _NTB_AXISMENU_BUTTON, "Axes: ", style=wx.BU_EXACTFIT) self._toolbar = parent self._menu =wx.Menu() self._axisId = [] # First two menu items never change... self._allId =wx.NewId() self._invertId =wx.NewId() self._menu.Append(self._allId, "All", "Select all axes", False) self._menu.Append(self._invertId, "Invert", "Invert axes selected", False) self._menu.AppendSeparator() bind(self, wx.EVT_BUTTON, self._onMenuButton, id=_NTB_AXISMENU_BUTTON) bind(self, wx.EVT_MENU, self._handleSelectAllAxes, id=self._allId) bind(self, wx.EVT_MENU, self._handleInvertAxesSelected, id=self._invertId)
Example #14
Source File: backend_wx.py From Mastering-Elasticsearch-7.0 with MIT License | 6 votes |
def __init__(self, parent): wx.Button.__init__(self, parent, wx.ID_ANY, "Axes: ", style=wx.BU_EXACTFIT) self._toolbar = parent self._menu = wx.Menu() self._axisId = [] # First two menu items never change... self._allId = wx.NewId() self._invertId = wx.NewId() self._menu.Append(self._allId, "All", "Select all axes", False) self._menu.Append(self._invertId, "Invert", "Invert axes selected", False) self._menu.AppendSeparator() self.Bind(wx.EVT_BUTTON, self._onMenuButton, id=self.GetId()) self.Bind(wx.EVT_MENU, self._handleSelectAllAxes, id=self._allId) self.Bind(wx.EVT_MENU, self._handleInvertAxesSelected, id=self._invertId)
Example #15
Source File: dialog_push.py From RF-Monitor with GNU General Public License v2.0 | 6 votes |
def __init__(self, parent, settings): self._settings = settings pre = wx.PreDialog() self._ui = load_ui('DialogPush.xrc') self._ui.LoadOnDialog(pre, parent, 'DialogPush') self.PostCreate(pre) self._checkEnable = xrc.XRCCTRL(pre, 'checkEnable') self._editUri = xrc.XRCCTRL(pre, 'editUri') self._buttonOk = xrc.XRCCTRL(pre, 'wxID_OK') self._checkEnable.SetValue(settings.get_push_enable()) self._editUri.SetValue(settings.get_push_uri()) self.Bind(wx.EVT_BUTTON, self.__on_ok, self._buttonOk)
Example #16
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 #17
Source File: wxPython_Wallpaper.py From Python-GUI-Programming-Cookbook-Second-Edition with MIT License | 6 votes |
def __init__(self, parent): wx.Panel.__init__(self, parent) imageFile = 'Tile.bmp' self.bmp = wx.Bitmap(imageFile) # react to a resize event and redraw image parent.Bind(wx.EVT_SIZE, self.canvasCallback) menu = wx.Menu() menu.Append(wx.ID_ABOUT, "About", "wxPython GUI") menu.AppendSeparator() menu.Append(wx.ID_EXIT, "Exit", " Exit the GUI") menuBar = wx.MenuBar() menuBar.Append(menu, "File") parent.SetMenuBar(menuBar) self.textWidget = wx.TextCtrl(self, size=(280, 80), style=wx.TE_MULTILINE) button = wx.Button(self, label="Create OpenGL 3D Cube", pos=(60, 100)) self.Bind(wx.EVT_BUTTON, self.buttonCallback, button) parent.CreateStatusBar()
Example #18
Source File: wxPython_OpenGL_GUI.py From Python-GUI-Programming-Cookbook-Second-Edition with MIT License | 6 votes |
def __init__(self, parent): wx.Panel.__init__(self, parent) menu = wx.Menu() menu.Append(wx.ID_ABOUT, "About", "wxPython GUI") menu.AppendSeparator() menu.Append(wx.ID_EXIT, "Exit", " Exit the GUI") menuBar = wx.MenuBar() menuBar.Append(menu, "File") parent.SetMenuBar(menuBar) self.textWidget = wx.TextCtrl(self, size=(280, 80), style=wx.TE_MULTILINE) button = wx.Button(self, label="Create OpenGL 3D Cube", pos=(60, 100)) self.Bind(wx.EVT_BUTTON, self.buttonCallback, button) parent.CreateStatusBar()
Example #19
Source File: backend_wx.py From neural-network-animation with MIT License | 6 votes |
def __init__(self, parent): wx.Button.__init__(self, parent, _NTB_AXISMENU_BUTTON, "Axes: ", style=wx.BU_EXACTFIT) self._toolbar = parent self._menu =wx.Menu() self._axisId = [] # First two menu items never change... self._allId =wx.NewId() self._invertId =wx.NewId() self._menu.Append(self._allId, "All", "Select all axes", False) self._menu.Append(self._invertId, "Invert", "Invert axes selected", False) self._menu.AppendSeparator() bind(self, wx.EVT_BUTTON, self._onMenuButton, id=_NTB_AXISMENU_BUTTON) bind(self, wx.EVT_MENU, self._handleSelectAllAxes, id=self._allId) bind(self, wx.EVT_MENU, self._handleInvertAxesSelected, id=self._invertId)
Example #20
Source File: backend_wx.py From GraphicDesignPatternByPython with MIT License | 6 votes |
def __init__(self, parent): wx.Button.__init__(self, parent, _NTB_AXISMENU_BUTTON, "Axes: ", style=wx.BU_EXACTFIT) self._toolbar = parent self._menu = wx.Menu() self._axisId = [] # First two menu items never change... self._allId = wx.NewId() self._invertId = wx.NewId() self._menu.Append(self._allId, "All", "Select all axes", False) self._menu.Append(self._invertId, "Invert", "Invert axes selected", False) self._menu.AppendSeparator() self.Bind(wx.EVT_BUTTON, self._onMenuButton, id=_NTB_AXISMENU_BUTTON) self.Bind(wx.EVT_MENU, self._handleSelectAllAxes, id=self._allId) self.Bind(wx.EVT_MENU, self._handleInvertAxesSelected, id=self._invertId)
Example #21
Source File: backend_wx.py From GraphicDesignPatternByPython with MIT License | 6 votes |
def __init__(self, parent, help_entries): wx.Dialog.__init__(self, parent, title="Help", style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) sizer = wx.BoxSizer(wx.VERTICAL) grid_sizer = wx.FlexGridSizer(0, 3, 8, 6) # create and add the entries bold = self.GetFont().MakeBold() for r, row in enumerate(self.headers + help_entries): for (col, width) in zip(row, self.widths): label = wx.StaticText(self, label=col) if r == 0: label.SetFont(bold) label.Wrap(width) grid_sizer.Add(label, 0, 0, 0) # finalize layout, create button sizer.Add(grid_sizer, 0, wx.ALL, 6) OK = wx.Button(self, wx.ID_OK) sizer.Add(OK, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 8) self.SetSizer(sizer) sizer.Fit(self) self.Layout() self.Bind(wx.EVT_CLOSE, self.OnClose) OK.Bind(wx.EVT_BUTTON, self.OnClose)
Example #22
Source File: preview.py From IkaLog with Apache License 2.0 | 6 votes |
def __init__(self, *args, **kwargs): wx.Panel.__init__(self, *args, **kwargs) # This is used to determine if a file dialog is open or not. self.prev_file_path = '' # Textbox for input file self.text_ctrl = wx.TextCtrl(self, wx.ID_ANY, '') self.text_ctrl.Bind(wx.EVT_TEXT, self.on_text_input) self.button = wx.Button(self, wx.ID_ANY, _('Browse')) self.button.Bind(wx.EVT_BUTTON, self.on_button_click) # Drag and drop drop_target = FileDropTarget(self) self.text_ctrl.SetDropTarget(drop_target) top_sizer = wx.BoxSizer(wx.HORIZONTAL) top_sizer.Add(self.text_ctrl, proportion=1) top_sizer.Add(self.button) self.SetSizer(top_sizer)
Example #23
Source File: backend_wx.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
def __init__(self, parent): wx.Button.__init__(self, parent, _NTB_AXISMENU_BUTTON, "Axes: ", style=wx.BU_EXACTFIT) self._toolbar = parent self._menu = wx.Menu() self._axisId = [] # First two menu items never change... self._allId = wx.NewId() self._invertId = wx.NewId() self._menu.Append(self._allId, "All", "Select all axes", False) self._menu.Append(self._invertId, "Invert", "Invert axes selected", False) self._menu.AppendSeparator() self.Bind(wx.EVT_BUTTON, self._onMenuButton, id=_NTB_AXISMENU_BUTTON) self.Bind(wx.EVT_MENU, self._handleSelectAllAxes, id=self._allId) self.Bind(wx.EVT_MENU, self._handleInvertAxesSelected, id=self._invertId)
Example #24
Source File: backend_wx.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
def __init__(self, parent, help_entries): wx.Dialog.__init__(self, parent, title="Help", style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) sizer = wx.BoxSizer(wx.VERTICAL) grid_sizer = wx.FlexGridSizer(0, 3, 8, 6) # create and add the entries bold = self.GetFont().MakeBold() for r, row in enumerate(self.headers + help_entries): for (col, width) in zip(row, self.widths): label = wx.StaticText(self, label=col) if r == 0: label.SetFont(bold) label.Wrap(width) grid_sizer.Add(label, 0, 0, 0) # finalize layout, create button sizer.Add(grid_sizer, 0, wx.ALL, 6) OK = wx.Button(self, wx.ID_OK) sizer.Add(OK, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 8) self.SetSizer(sizer) sizer.Fit(self) self.Layout() self.Bind(wx.EVT_CLOSE, self.OnClose) OK.Bind(wx.EVT_BUTTON, self.OnClose)
Example #25
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 #26
Source File: gui.py From superpaper with MIT License | 6 votes |
def create_buttons(self, use_ppi_px): """Create buttons for display preview positioning config.""" # Buttons - show only if use_ppi_px == True self.button_config = wx.Button(self, label="Positions") self.button_save = wx.Button(self, label="Save") self.button_reset = wx.Button(self, label="Reset") self.button_cancel = wx.Button(self, label="Cancel") help_bmp = wx.ArtProvider.GetBitmap(wx.ART_QUESTION, wx.ART_BUTTON, (20, 20)) self.button_help = wx.BitmapButton(self, bitmap=help_bmp, name="butt_help") self.button_config.Bind(wx.EVT_BUTTON, self.onConfigure) self.button_save.Bind(wx.EVT_BUTTON, self.onSave) self.button_reset.Bind(wx.EVT_BUTTON, self.onReset) self.button_cancel.Bind(wx.EVT_BUTTON, self.onCancel) self.button_help.Bind(wx.EVT_BUTTON, self.onHelp) self.move_buttons() self.button_config.Show(use_ppi_px) self.button_save.Show(False) self.button_reset.Show(False) self.button_cancel.Show(False)
Example #27
Source File: backend_wx.py From matplotlib-4-abaqus with MIT License | 6 votes |
def __init__(self, parent): wx.Button.__init__(self, parent, _NTB_AXISMENU_BUTTON, "Axes: ", style=wx.BU_EXACTFIT) self._toolbar = parent self._menu =wx.Menu() self._axisId = [] # First two menu items never change... self._allId =wx.NewId() self._invertId =wx.NewId() self._menu.Append(self._allId, "All", "Select all axes", False) self._menu.Append(self._invertId, "Invert", "Invert axes selected", False) self._menu.AppendSeparator() bind(self, wx.EVT_BUTTON, self._onMenuButton, id=_NTB_AXISMENU_BUTTON) bind(self, wx.EVT_MENU, self._handleSelectAllAxes, id=self._allId) bind(self, wx.EVT_MENU, self._handleInvertAxesSelected, id=self._invertId)
Example #28
Source File: gui.py From superpaper with MIT License | 5 votes |
def create_sizer_profiles(self): # choice menu self.list_of_profiles = list_profiles() self.profnames = [] for prof in self.list_of_profiles: self.profnames.append(prof.name) self.profnames.append("Create a new profile") self.choice_profiles = wx.Choice(self, -1, name="ProfileChoice", choices=self.profnames) self.choice_profiles.Bind(wx.EVT_CHOICE, self.onSelect) st_choice_profiles = wx.StaticText(self, -1, "Setting profiles:") # name txt ctrl st_name = wx.StaticText(self, -1, "Profile name:") self.tc_name = wx.TextCtrl(self, -1, size=(self.tc_width, -1)) self.tc_name.SetMaxLength(14) # buttons self.button_new = wx.Button(self, label="New") self.button_save = wx.Button(self, label="Save") self.button_delete = wx.Button(self, label="Delete") self.button_new.Bind(wx.EVT_BUTTON, self.onCreateNewProfile) self.button_save.Bind(wx.EVT_BUTTON, self.onSave) self.button_delete.Bind(wx.EVT_BUTTON, self.onDeleteProfile) # Add elements to the sizer self.sizer_profiles.Add(st_choice_profiles, 0, wx.CENTER|wx.ALL, 5) self.sizer_profiles.Add(self.choice_profiles, 0, wx.CENTER|wx.ALL, 5) self.sizer_profiles.Add(st_name, 0, wx.CENTER|wx.ALL, 5) self.sizer_profiles.Add(self.tc_name, 0, wx.CENTER|wx.ALL, 5) self.sizer_profiles.Add(self.button_new, 0, wx.CENTER|wx.ALL, 5) self.sizer_profiles.Add(self.button_save, 0, wx.CENTER|wx.ALL, 5) self.sizer_profiles.Add(self.button_delete, 0, wx.CENTER|wx.ALL, 5)
Example #29
Source File: SampleAPDUManagerPanel.py From pyscard with GNU Lesser General Public License v2.1 | 5 votes |
def __init__(self, parent): wx.Panel.__init__(self, parent, -1) SimpleSCardAppEventObserver.__init__(self) self.layoutControls() self.Bind(wx.EVT_BUTTON, self.OnTransmit, self.transmitbutton) # callbacks from SimpleSCardAppEventObserver interface
Example #30
Source File: misc.py From trelby with GNU General Public License v2.0 | 5 votes |
def __init__(self, parent, text, title, validateFunc = None): wx.Dialog.__init__(self, parent, -1, title, style = wx.DEFAULT_DIALOG_STYLE | wx.WANTS_CHARS) # function to call to validate the input string on OK. can be # None, in which case it is not called. if it returns "", the # input is valid, otherwise the string it returns is displayed in # a message box and the dialog is not closed. self.validateFunc = validateFunc vsizer = wx.BoxSizer(wx.VERTICAL) vsizer.Add(wx.StaticText(self, -1, text), 1, wx.EXPAND | wx.BOTTOM, 5) self.tc = wx.TextCtrl(self, -1, style = wx.TE_PROCESS_ENTER) vsizer.Add(self.tc, 1, wx.EXPAND); vsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) hsizer = wx.BoxSizer(wx.HORIZONTAL) cancelBtn = gutil.createStockButton(self, "Cancel") hsizer.Add(cancelBtn) okBtn = gutil.createStockButton(self, "OK") hsizer.Add(okBtn, 0, wx.LEFT, 10) vsizer.Add(hsizer, 0, wx.EXPAND | wx.TOP, 5) util.finishWindow(self, vsizer) wx.EVT_BUTTON(self, cancelBtn.GetId(), self.OnCancel) wx.EVT_BUTTON(self, okBtn.GetId(), self.OnOK) wx.EVT_TEXT_ENTER(self, self.tc.GetId(), self.OnOK) wx.EVT_CHAR(self.tc, self.OnCharEntry) wx.EVT_CHAR(cancelBtn, self.OnCharButton) wx.EVT_CHAR(okBtn, self.OnCharButton) self.tc.SetFocus()