当前位置: 首页>>代码示例>>Python>>正文


Python wx.EVT_BUTTON属性代码示例

本文整理汇总了Python中wx.EVT_BUTTON属性的典型用法代码示例。如果您正苦于以下问题:Python wx.EVT_BUTTON属性的具体用法?Python wx.EVT_BUTTON怎么用?Python wx.EVT_BUTTON使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在wx的用法示例。


在下文中一共展示了wx.EVT_BUTTON属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_BUTTON [as 别名]
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() 
开发者ID:trelby,项目名称:trelby,代码行数:23,代码来源:misc.py

示例2: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_BUTTON [as 别名]
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) 
开发者ID:EarToEarOak,项目名称:RF-Monitor,代码行数:18,代码来源:dialog_push.py

示例3: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_BUTTON [as 别名]
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) 
开发者ID:ME-ICA,项目名称:me-ica,代码行数:22,代码来源:footer.py

示例4: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_BUTTON [as 别名]
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) 
开发者ID:ME-ICA,项目名称:me-ica,代码行数:26,代码来源:calender_dialog.py

示例5: build

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_BUTTON [as 别名]
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 
开发者ID:ME-ICA,项目名称:me-ica,代码行数:19,代码来源:widget_pack.py

示例6: createStockButton

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_BUTTON [as 别名]
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. 
开发者ID:trelby,项目名称:trelby,代码行数:26,代码来源:gutil.py

示例7: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_BUTTON [as 别名]
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) 
开发者ID:trelby,项目名称:trelby,代码行数:18,代码来源:charmapdlg.py

示例8: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_BUTTON [as 别名]
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) 
开发者ID:NVDARemote,项目名称:NVDARemote,代码行数:18,代码来源:dialogs.py

示例9: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_BUTTON [as 别名]
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 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:24,代码来源:core.py

示例10: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_BUTTON [as 别名]
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) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:19,代码来源:backend_wx.py

示例11: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_BUTTON [as 别名]
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) 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:21,代码来源:backend_wx.py

示例12: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_BUTTON [as 别名]
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) 
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-Cookbook-Second-Edition,代码行数:27,代码来源:import_OpenGL_cube_and_cone.py

示例13: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_BUTTON [as 别名]
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() 
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-Cookbook-Second-Edition,代码行数:24,代码来源:wxPython_Wallpaper.py

示例14: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_BUTTON [as 别名]
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() 
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-Cookbook-Second-Edition,代码行数:19,代码来源:wxPython_OpenGL_GUI.py

示例15: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_BUTTON [as 别名]
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) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:21,代码来源:backend_wx.py


注:本文中的wx.EVT_BUTTON属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。