Wxpython & threads: how to simulate wx.EVT_BUTTON trigger?

If I have a "parent" window (wxFrame) and a plugin window.

(parent.py)

class App(wx.App):
            wxctrl = xrc.XRCCTRL( self.x_panel, "BUTTON")
            wx.EVT_BUTTON(wxctrl, wxctrl.GetId(),
                       self.OnButton)

      

How can I dispatch an event from plugin.py that simulates clicking 'Button'?

0


a source to share


1 answer


The class wx.Control

(base class wx.Button

) has a function Command

that simulates a command event. Try this

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 C ++ versions of wxWidgets). But this is a rough plan.

0


a source







All Articles