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


Python wx.PyEventBinder方法代码示例

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


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

示例1: _CommandEvent

# 需要导入模块: import wx [as 别名]
# 或者: from wx import PyEventBinder [as 别名]
def _CommandEvent():
    """Generate new (CmdEvent, Binder) tuple
        e.g. MooCmdEvent, EVT_MOO = EgCommandEvent()
    """
    evttype = wx.NewEventType()

    class _Event(wx.PyCommandEvent):
        def __init__(self, id, **kw):
            wx.PyCommandEvent.__init__(self, evttype, id)
            self.__dict__.update(kw)
            if not hasattr(self, "value"):
                self.value = None

        def GetValue(self):
            return self.value

        def SetValue(self, value):
            self.value = value

    return _Event, wx.PyEventBinder(evttype, 1) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:22,代码来源:Core.py

示例2: _EvtHandler_Bind

# 需要导入模块: import wx [as 别名]
# 或者: from wx import PyEventBinder [as 别名]
def _EvtHandler_Bind(self, event, handler, source=None, id=wx.ID_ANY, id2=wx.ID_ANY):
    """
    Bind an event to an event handler.
    
    :param event: One of the ``EVT_*`` event binder objects that
                  specifies the type of event to bind.
    
    :param handler: A callable object to be invoked when the
                    event is delivered to self.  Pass ``None`` to
                    disconnect an event handler.
    
    :param source: Sometimes the event originates from a
                   different window than self, but you still
                   want to catch it in self.  (For example, a
                   button event delivered to a frame.)  By
                   passing the source of the event, the event
                   handling system is able to differentiate
                   between the same event type from different
                   controls.
    
    :param id: Used to spcify the event source by ID instead
               of instance.
    
    :param id2: Used when it is desirable to bind a handler
                to a range of IDs, such as with EVT_MENU_RANGE.
    """
    assert isinstance(event, wx.PyEventBinder)
    assert callable(handler) or handler is None
    assert source is None or hasattr(source, 'GetId')
    if source is not None:
        id  = source.GetId()
    event.Bind(self, id, id2, handler) 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:34,代码来源:core.py

示例3: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import PyEventBinder [as 别名]
def __init__(self, parent, id=wx.ID_ANY, value="", pos=wx.DefaultPosition,
            size=wx.DefaultSize, choices=[], style=0, validator=wx.DefaultValidator, name=NAME):
        super(CustomComboBox, self).__init__(parent, id, pos, size, 0, name)

        assert style == self.CB_READONLY or style == 0

        # Create components
        self.textctrl = wx.TextCtrl(self, wx.ID_ANY, style=style, validator=validator)
        tc_height = self.textctrl.GetSize()[1]

        self.button = wx.Button(self, wx.ID_ANY, "▾", size=(tc_height, tc_height))

        # Create the ListBoxPopup in two steps
        self.listbox = ListBoxPopup(self)
        self.listbox.Init()
        self.listbox.Create(self.listbox)

        # Set layout
        sizer = wx.BoxSizer()
        sizer.Add(self.textctrl, 1, wx.ALIGN_CENTER_VERTICAL)
        sizer.Add(self.button)
        self.SetSizer(sizer)

        # Bind events
        self.button.Bind(wx.EVT_BUTTON, self._on_button)

        for event in ListBoxPopup.EVENTS_TABLE.values():
            self.listbox.Bind(wx.PyEventBinder(event.GetEventType()), self._propagate)

        # Append items since the ListBoxPopup does not have the 'choices' arg
        self.listbox.GetControl().AppendItems(choices)
        self.SetStringSelection(value) 
开发者ID:MrS0m30n3,项目名称:youtube-dl-gui,代码行数:34,代码来源:widgets.py

示例4: _bind

# 需要导入模块: import wx [as 别名]
# 或者: from wx import PyEventBinder [as 别名]
def _bind(self, ctlName, evt=None, proc=None):
    if isinstance(ctlName, wx.PyEventBinder): # binding to self
      ctl=super(wx.Window, self)
      proc=evt
      evt=ctlName
    elif isinstance(ctlName, wx.Window):
      ctl=ctlName
    else:
      ctl=self[ctlName]

    if not proc:
      if not isinstance(evt, wx.PyEventBinder):
        proc=evt
        evt=None
      if not proc:
        proc=self.OnCheck

    if not evt:
      if isinstance(ctl, wx.Button):
        evt=wx.EVT_BUTTON
      elif isinstance(ctl, wx.CheckBox):
        evt=wx.EVT_CHECKBOX
      elif isinstance(ctl, wx.CheckListBox):
        evt=wx.EVT_CHECKLISTBOX
      elif isinstance(ctl, wx.RadioButton):
        evt=wx.EVT_RADIOBUTTON
      else:
        evt=wx.EVT_TEXT
        if isinstance(ctl, wx.ComboBox):
          ctl.Bind(wx.EVT_COMBOBOX, proc)
    ctl.Bind(evt, proc) 
开发者ID:andreas-p,项目名称:admin4,代码行数:33,代码来源:controlcontainer.py

示例5: _EventMaker

# 需要导入模块: import wx [as 别名]
# 或者: from wx import PyEventBinder [as 别名]
def _EventMaker():
    evt = wx.NewEventType()
    return (evt, wx.PyEventBinder(evt)) 
开发者ID:JackonYang,项目名称:bookhub,代码行数:5,代码来源:OLVEvent.py


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