Python wx.PyCommandEvent() Examples

The following are 13 code examples of wx.PyCommandEvent(). 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: gui.py    From atbswp with GNU General Public License v3.0 6 votes vote down vote up
def on_key_press(self, event):
        """ Create manually the event when the correct key is pressed."""
        keycode = event.GetKeyCode()
        if keycode == wx.WXK_F1:
            control.HelpCtrl.action(wx.PyCommandEvent(wx.wxEVT_BUTTON))
        elif keycode == settings.CONFIG.getint('DEFAULT', 'Recording Hotkey'):
            btnEvent = wx.CommandEvent(wx.wxEVT_TOGGLEBUTTON)
            btnEvent.EventObject = self.record_button
            if not self.record_button.Value:
                self.record_button.Value = True
                self.rbc.action(btnEvent)
            else:
                self.record_button.Value = False
                self.rbc.action(btnEvent)
        elif keycode == settings.CONFIG.getint('DEFAULT', 'Playback Hotkey'):
            if not self.play_button.Value:
                self.play_button.Value = True
                btnEvent = wx.CommandEvent(wx.wxEVT_TOGGLEBUTTON)
                btnEvent.EventObject = self.play_button
                control.PlayCtrl().action(btnEvent)
        else:
            event.Skip() 
Example #2
Source File: Core.py    From EventGhost with GNU General Public License v2.0 6 votes vote down vote up
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) 
Example #3
Source File: recipe-577951.py    From code with MIT License 5 votes vote down vote up
def __init__(self, eventType, eventId):
        """
        Default class constructor.

        :param `eventType`: the event type;
        :param `eventId`: the event identifier.
        """
        
        wx.PyCommandEvent.__init__(self, eventType, eventId)
        self.isDown = False
        self.theButton = None 
Example #4
Source File: dfgui.py    From PandasDataFrameGUI with MIT License 5 votes vote down vote up
def swap(self, i, j):
        self.index_mapping[i], self.index_mapping[j] = self.index_mapping[j], self.index_mapping[i]
        self.SetString(i, self.data[self.index_mapping[i]])
        self.SetString(j, self.data[self.index_mapping[j]])
        self.selected_items[i], self.selected_items[j] = self.selected_items[j], self.selected_items[i]
        # self.update_selection()
        # print("Updated mapping:", self.index_mapping)
        new_event = wx.PyCommandEvent(wx.EVT_LISTBOX.typeId, self.GetId())
        self.GetEventHandler().ProcessEvent(new_event) 
Example #5
Source File: CustomIntCtrl.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, id, value=0, object=None):
        wx.PyCommandEvent.__init__(self, CustomIntCtrl.wxEVT_COMMAND_CUSTOM_INT_UPDATED, id)

        self.__value = value
        self.SetEventObject(object) 
Example #6
Source File: OLVEvent.py    From bookhub with MIT License 5 votes vote down vote up
def __init__(self, evtType):
        wx.PyCommandEvent.__init__(self, evtType, -1)
        self.veto = False 
Example #7
Source File: OLVEvent.py    From bookhub with MIT License 5 votes vote down vote up
def __init__(self, objectListView, groups):
        wx.PyCommandEvent.__init__(self, olv_EVT_GROUP_CREATING, -1)
        self.objectListView = objectListView
        self.groups = groups

#---------------------------------------------------------------------------- 
Example #8
Source File: OLVEvent.py    From bookhub with MIT License 5 votes vote down vote up
def __init__(self, objectListView, groups, sortColumn, sortAscending):
        wx.PyCommandEvent.__init__(self, olv_EVT_GROUP_SORT, -1)
        self.objectListView = objectListView
        self.groups = groups
        self.sortColumn = sortColumn
        self.sortAscending = sortAscending
        self.wasHandled = False 
Example #9
Source File: rstbx_frame.py    From dials with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __init__(self, eventType=EVT_EXTERNAL_UPDATE.evtType[0], id=0):
        wx.PyCommandEvent.__init__(self, eventType, id)
        self.img = None
        self.title = None 
Example #10
Source File: viewer_tools.py    From dials with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def SetSelection(self, index):
        if self._images.selected_index != index:
            # self._images.selected_index = index
            # print("Posting event from fake choice")
            # wx.PostEvent(self, wx.PyCommandEvent(wx.EVT_CHOICE.typeId, 1))
            self._loader(self._images[index]) 
Example #11
Source File: spotfinder_frame.py    From dials with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __init__(self, etype, eid, filename=None):
        """Creates the event object"""
        wx.PyCommandEvent.__init__(self, etype, eid)
        self._filename = filename 
Example #12
Source File: pyslip.py    From dials with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __init__(self, eventType, id):
        """Construct a PySlip event.

        eventType  type of event
        id         unique event number

        Event will be adorned with attributes by raising code.
        """

        wx.PyCommandEvent.__init__(self, eventType, id)


###############################################################################
# The wxPython pySlip widget proper
############################################################################### 
Example #13
Source File: serialEvent.py    From Zulu with GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(self, windowID, data):
        wx.PyCommandEvent.__init__(self, self.eventType, windowID)
        self.data = data