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


Python wx.CommandEvent方法代码示例

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


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

示例1: on_key_press

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

示例2: AskSave

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CommandEvent [as 别名]
def AskSave(self):
        if not (self.modified or panel.IsModified()): return True
        flags = wx.ICON_EXCLAMATION | wx.YES_NO | wx.CANCEL | wx.CENTRE
        dlg = wx.MessageDialog( self, 'File is modified. Save before exit?',
                               'Save before too late?', flags )
        say = dlg.ShowModal()
        dlg.Destroy()
        wx.Yield()
        if say == wx.ID_YES:
            self.OnSaveOrSaveAs(wx.CommandEvent(wx.ID_SAVE))
            # If save was successful, modified flag is unset
            if not self.modified: return True
        elif say == wx.ID_NO:
            self.SetModified(False)
            panel.SetModified(False)
            return True
        return False 
开发者ID:andreas-p,项目名称:admin4,代码行数:19,代码来源:xrced.py

示例3: OnButton

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CommandEvent [as 别名]
def OnButton(self, dummyEvent):
        result = eg.TreeItemBrowseDialog.GetModalResult(
            self.title,
            self.mesg,
            self.action,
            (eg.ActionItem,),
            filterClasses = (eg.FolderItem, eg.MacroItem, eg.ActionItem),
            parent=self
        )
        if result:
            action = result[0]
            self.textBox.SetLabel(result[0].GetLabel())
            self.action = action
            self.ProcessEvent(
                wx.CommandEvent(wx.EVT_TEXT.evtType[0], self.GetId())
            ) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:18,代码来源:ActionSelectButton.py

示例4: OnKeyDown

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CommandEvent [as 别名]
def OnKeyDown(self, event):
        button = None
        keycode = event.GetKeyCode()
        if keycode in (wx.WXK_ADD, wx.WXK_NUMPAD_ADD):
            button = self.GetNewButton()
        elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE):
            button = self.GetDelButton()
        elif keycode == wx.WXK_UP and event.ShiftDown():
            button = self.GetUpButton()
        elif keycode == wx.WXK_DOWN and event.ShiftDown():
            button = self.GetDownButton()
        elif keycode == wx.WXK_SPACE:
            button = self.GetEditButton()
        if button is not None and button.IsEnabled():
            button.ProcessEvent(wx.CommandEvent(wx.EVT_BUTTON.typeId, button.GetId()))
        else:
            event.Skip() 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:19,代码来源:CustomEditableListBox.py

示例5: OnMouseDown

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CommandEvent [as 别名]
def OnMouseDown(self, event):
        clickEvent = wx.CommandEvent(wx.wxEVT_COMMAND_BUTTON_CLICKED, self.GetId())
        clickEvent.SetEventObject(self)
        self.GetEventHandler().ProcessEvent(clickEvent)

# custom status control 
开发者ID:trelby,项目名称:trelby,代码行数:8,代码来源:misc.py

示例6: test_optional_radiogroup_click_behavior

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CommandEvent [as 别名]
def test_optional_radiogroup_click_behavior(self):
        """
        Testing that select/deselect behaves as expected
        """
        testcases = [
            self.click_scenarios_optional_widget(),
            self.click_scenarios_required_widget(),
            self.click_scenarios_initial_selection()
        ]

        for testcase in testcases:
            with self.subTest(testcase['name']):
                # wire up the parse with our test case options
                parser = self.mutext_group(testcase['input'])

                with instrumentGooey(parser) as (app, gooeyApp):
                    radioGroup = gooeyApp.configs[0].reifiedWidgets[0]

                    for scenario in testcase['scenario']:
                        targetButton = scenario['clickButton']

                        event = wx.CommandEvent(wx.wxEVT_LEFT_DOWN, wx.Window.NewControlId())
                        event.SetEventObject(radioGroup.radioButtons[targetButton])

                        radioGroup.radioButtons[targetButton].ProcessEvent(event)

                        expectedEnabled, expectedDisabled = scenario['postState']

                        for index in expectedEnabled:
                            self.assertEqual(radioGroup.selected, radioGroup.radioButtons[index])
                            self.assertTrue(radioGroup.widgets[index].IsEnabled())

                        for index in expectedDisabled:
                            self.assertNotEqual(radioGroup.selected, radioGroup.radioButtons[index])
                            self.assertFalse(radioGroup.widgets[index].IsEnabled()) 
开发者ID:chriskiehl,项目名称:Gooey,代码行数:37,代码来源:test_radiogroup.py

示例7: crt_command_event

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CommandEvent [as 别名]
def crt_command_event(event_type, event_id=0):
    """Shortcut to create command events."""
    return wx.CommandEvent(event_type.typeId, event_id) 
开发者ID:MrS0m30n3,项目名称:youtube-dl-gui,代码行数:5,代码来源:widgets.py

示例8: SendSelectorEvent

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CommandEvent [as 别名]
def SendSelectorEvent(self, box):
        if (isinstance(box, wx.CheckBox)):
            # I have the feeling that this is the wrong way to trigger
            # an event.
            newevent = wx.CommandEvent(wx.EVT_CHECKBOX.evtType[0])
            newevent.SetEventObject(box)
            wx.PostEvent(box, newevent)

        if (isinstance(box, wx.RadioButton)):
            newevent = wx.CommandEvent(wx.EVT_RADIOBUTTON.evtType[0])
            newevent.SetEventObject(box)
            wx.PostEvent(box, newevent) 
开发者ID:mmccoo,项目名称:kicad_mmccoo,代码行数:14,代码来源:DialogUtils.py

示例9: Save

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CommandEvent [as 别名]
def Save(self, path):
        try:
            import codecs
            # Apply changes
            if tree.selection and panel.IsModified():
                self.OnRefresh(wx.CommandEvent())
            if g.currentEncoding:
                f = codecs.open(path, 'wt', g.currentEncoding)
            else:
                f = codecs.open(path, 'wt')
            # Make temporary copy for formatting it
            # !!! We can't clone dom node, it works only once
            #self.domCopy = tree.dom.cloneNode(True)
            self.domCopy = MyDocument()
            mainNode = self.domCopy.appendChild(tree.mainNode.cloneNode(True))
            # Remove first child (test element)
            testElem = mainNode.firstChild
            mainNode.removeChild(testElem)
            testElem.unlink()
            self.Indent(mainNode)
            self.domCopy.writexml(f, encoding = g.currentEncoding)
            f.close()
            self.domCopy.unlink()
            self.domCopy = None
            self.SetModified(False)
            panel.SetModified(False)
            conf.localconf.Flush()
        except:
            inf = sys.exc_info()
            wx.LogError(traceback.format_exception(inf[0], inf[1], None)[-1])
            wx.LogError('Error writing file: %s' % path)
            raise 
开发者ID:andreas-p,项目名称:admin4,代码行数:34,代码来源:xrced.py

示例10: OnSelect

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CommandEvent [as 别名]
def OnSelect(self, event):
        self.value = event.GetId()
        newEvent = wx.CommandEvent(wx.EVT_RADIOBOX.evtType[0], self.GetId())
        newEvent.SetInt(self.value)
        self.ProcessEvent(newEvent) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:7,代码来源:RadioBox.py

示例11: OnButton

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CommandEvent [as 别名]
def OnButton(self, dummyEvent):
        result = eg.TreeItemBrowseDialog.GetModalResult(
            self.title,
            self.mesg,
            self.macro,
            (eg.MacroItem,),
            parent=self
        )
        if result:
            macro = result[0]
            self.textBox.SetLabel(macro.name)
            self.macro = macro
            self.ProcessEvent(
                wx.CommandEvent(wx.EVT_TEXT.evtType[0], self.GetId())
            ) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:17,代码来源:MacroSelectButton.py

示例12: OnItemActivated

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CommandEvent [as 别名]
def OnItemActivated(self, event):
        item = self.treeCtrl.GetSelection()
        info = self.treeCtrl.GetPyData(item)
        if info is not None:
            #self.SetResult("huhu")
            self.OnOK(wx.CommandEvent())
            return
        event.Skip() 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:10,代码来源:AddPluginDialog.py

示例13: OnActivated

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CommandEvent [as 别名]
def OnActivated(self, event):
        """
        Process wx.EVT_TREE_ITEM_ACTIVATED events.
        """
        treeItem = self.tree.GetSelection()
        itemData = self.tree.GetPyData(treeItem)
        if isinstance(itemData, eg.ActionGroup):
            event.Skip()
        else:
            self.OnOK(wx.CommandEvent()) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:12,代码来源:AddActionDialog.py

示例14: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CommandEvent [as 别名]
def __init__(
        self,
        parent,
        id=-1,
        key = _winreg.HKEY_CURRENT_USER,
        subkey = "Software",
        valueName = None,
        pos = wx.DefaultPosition,
        size = wx.DefaultSize,
        style = wx.TR_HAS_BUTTONS,
        validator = wx.DefaultValidator,
        name="RegistryLazyTree",
        text = None
    ):
        self.text = text
        wx.TreeCtrl.__init__(
            self, parent, id, pos, size, style, validator, name
        )

        self.imageList = imageList = wx.ImageList(16, 16)
        rootIcon = imageList.Add(eg.Icons.GetInternalBitmap("root"))
        self.folderIcon = imageList.Add(eg.Icons.GetInternalBitmap("folder"))
        self.valueIcon = imageList.Add(eg.Icons.GetInternalBitmap("action"))
        self.SetImageList(imageList)
        self.SetMinSize((-1, 200))
        self.treeRoot = self.AddRoot(
            "Registry",
            image = rootIcon,
            data = wx.TreeItemData((True, None, None, None))
        )
        #Adding keys
        for item in regKeys:
            #a tupel of 4 values is assigned to every item
            #1) stores if the key has yet to be queried for subkey, when
            #   selected
            #2) _winreg.hkey constant
            #3) name of the key
            #4) value name, None if just a key, empty string for default value
            tmp = self.AppendItem(
                self.treeRoot,
                item[1],
                image = self.folderIcon,
                data =wx.TreeItemData((False, item[0], "", None))
            )
            self.SetItemHasChildren(tmp, True)
            if item[0] == key:
                self.SelectItem(tmp)

        #select old value in tree
        self.OnTreeChange(wx.CommandEvent(), key, subkey, valueName)
        self.EnsureVisible(self.GetSelection())

        self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnTreeChange)
        self.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.OnExpandNode) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:56,代码来源:Registry.py


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