If I have a 'parent' window (wxFrame), and a plugin window.
如果我有一个'父'窗口(wxFrame)和一个插件窗口。
(parent.py)
class App(wx.App):
wxctrl = xrc.XRCCTRL( self.x_panel, "BUTTON")
wx.EVT_BUTTON(wxctrl, wxctrl.GetId(),
self.OnButton)
How could I send an event from plugin.py that mimics clicking 'Button'?
如何从plugin.py发送一个模仿点击“按钮”的事件?
1 个解决方案
#1
The class wx.Control
(base class of wx.Button
) has a function Command
that simulates a command event. Try this one
类wx.Control(wx.Button的基类)有一个模拟命令事件的函数Command。试试这个
event = wx.CommandEvent(wx.EVT_COMMAND_BUTTON_CLICKED, self.wxctrl.GetId())
self.wxctrl.Command(event)
I'm not sure about the python syntax (programming in the C++ version of wxWidgets normally). But that's the rough plan.
我不确定python语法(通常在wxWidgets的C ++版本中编程)。但那是粗略的计划。
#1
The class wx.Control
(base class of wx.Button
) has a function Command
that simulates a command event. Try this one
类wx.Control(wx.Button的基类)有一个模拟命令事件的函数Command。试试这个
event = wx.CommandEvent(wx.EVT_COMMAND_BUTTON_CLICKED, self.wxctrl.GetId())
self.wxctrl.Command(event)
I'm not sure about the python syntax (programming in the C++ version of wxWidgets normally). But that's the rough plan.
我不确定python语法(通常在wxWidgets的C ++版本中编程)。但那是粗略的计划。