views:

405

answers:

1

Hi,

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 could I send an event from plugin.py that mimics clicking 'Button'?

A: 

The class wx.Control (base class of wx.Button) has a function Command that simulates a command event. Try this one

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.

Johannes Schaub - litb