Python wx.EVT_CONTEXT_MENU Examples

The following are 4 code examples of wx.EVT_CONTEXT_MENU(). 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: CustomWidgets.py    From BitTorrent with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, listctrl):
        # I'll be nice and ignore you.
        if not isinstance(listctrl, wx.ListCtrl):
            return
        self.listctrl = listctrl
        self.Bind(wx.EVT_LEFT_DOWN, self.LeftDown)
        self.Bind(wx.EVT_LEFT_DCLICK, self.LeftDClick)
        self.Bind(wx.EVT_CONTEXT_MENU, self.ContextMenu) 
Example #2
Source File: ListCtrl.py    From BitTorrent with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        self.context_menu = None
        self.column_context_menu = None
        self.Bind(wx.EVT_CONTEXT_MENU, self.OnContextMenu)
        self.Bind(wx.EVT_LIST_COL_RIGHT_CLICK, self.OnColumnContextMenu) 
Example #3
Source File: SettingsWindow.py    From BitTorrent with GNU General Public License v3.0 5 votes vote down vote up
def new_sample(self, sample_class, value):
        sample = sample_class(self, size=wx.Size(-1, 20), style=wx.SUNKEN_BORDER)
        # I happen to know 200 is the right number because I looked.
        sample.SetValue(self.sample_value, 'running', (200, 0, self.sample_data))
        sample.Bind(wx.EVT_LEFT_DOWN, self.sample)
        sample.Bind(wx.EVT_CONTEXT_MENU, None)
        sample.value = value
        return sample 
Example #4
Source File: relay_board_gui.py    From R421A08-rs485-8ch-relay-board with MIT License 4 votes vote down vote up
def __init__(self, parent, settings_file=None):
        frmRelays.__init__(self, parent)

        # Protect events when closing window
        self.closing_window = False

        # Set window size and minimum window size
        self.SetSize(wx.Size(580, 650))
        self.SetMinSize(wx.Size(580, 650))

        # Set application icon
        ico_path = resource_path('images/relay.ico')
        if ico_path:
            self.m_relay_icon = wx.Icon(ico_path)
            self.SetIcon(self.m_relay_icon)
        self.SetTitle('R421A08 Relay Control')

        # Create taskbar icon
        self.m_taskbar_icon = CustomTaskBarIcon(self, self.m_relay_icon)

        # Create MODBUS object
        self.m_relay_modbus = relay_modbus.Modbus()

        # Refresh serial ports
        self.OnRefreshPortsClick(None)
        self.m_menuItemDisconnect.Enable(False)

        # Load settings from file when available
        self.m_settings_file = settings_file
        self.m_panel_changed = False
        if self.m_settings_file and os.path.exists(self.m_settings_file):
            self.load_settings(self.m_settings_file)
        else:
            # Create default relay panel
            self.new_relay_panel()

            # Disable controls on relay panel
            self.disable_relay_panels()

            # Disable relay menu
            self.disable_relay_menu()

        self.m_notebook.Bind(wx.EVT_CONTEXT_MENU, self.OnContext)