ProcessEvent - Event as None

Hi guys,

I want to send a Right Clic event to a button. It works with the code above:

ce = wx.CommandEvent(wx.EVT_RIGHT_DOWN._getEvtType(), i.GetId())

i.ProcessEvent(ce)

i is the targeted button.

But there’s an error : as I use the Event to get information, with this method the Event is None. How can I send a “proper” event ?

Thank you for your help,

Arnaud

Define a class method with a type of Fn(self, evt) and in your
constructor bind the ex.EVT_RIGHT_DOWN for i to that method. You
can then access the event parameters using eve.param in your
function.
Gadget/Steve

···

On 12/05/14 15:54,
wrote:

arnaud.estublier@gmail.com

      Hi

guys,

      I want to send a

Right Clic event to a button. It works with the code above:

ce = wx.CommandEvent(wx.EVT_RIGHT_ DOWN._getEvtType(),
i.GetId())

i.ProcessEvent(ce)

      i is the targeted

button.

      But there's an

error : as I use the Event to get information, with this
method the Event is None. How can I send a “proper” event ?

      Thank you for your

help,

Arnaud

  You received this message because you are subscribed to the Google

Groups “wxPython-users” group.

  To unsubscribe from this group and stop receiving emails from it,

send an email to wxpython-users+unsubscribe@googlegroups.com.

  For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

Ok, I’ll try that. But I thought the creation of a CommandeEvent did the same thing, binding the event to the widget.
For the sake of the discussion, why sending an event to a button is not the same as actually clicking on a button ?

···

Le lundi 12 mai 2014 20:43:29 UTC+2, Gadget Steve a écrit :

  On 12/05/14 15:54, > arnaud.e...@gmail.com wrote:
      Hi

guys,

      I want to send a

Right Clic event to a button. It works with the code above:

ce = wx.CommandEvent(wx.EVT_RIGHT_ DOWN._getEvtType(),
i.GetId())

i.ProcessEvent(ce)

      i is the targeted

button.

      But there's an

error : as I use the Event to get information, with this
method the Event is None. How can I send a “proper” event ?

      Thank you for your

help,

Arnaud

  You received this message because you are subscribed to the Google

Groups “wxPython-users” group.

  To unsubscribe from this group and stop receiving emails from it,

send an email to wxpython-user...@googlegroups.com.

  For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
Define a class method with a type of Fn(self, evt) and in your

constructor bind the ex.EVT_RIGHT_DOWN for i to that method. You
can then access the event parameters using eve.param in your
function.

Gadget/Steve

Hum sorry, I answered wrong. I already done it, in my Button class my button is bound the this Event, and the function bound to it uses the Event to get information.

When I physically clic on the button, it works well. When I send the event through the code above the function can’t get any information from the Event, as it is Note type.

···

Le lundi 12 mai 2014 20:43:29 UTC+2, Gadget Steve a écrit :

  On 12/05/14 15:54, > arnaud.e...@gmail.com wrote:
      Hi

guys,

      I want to send a

Right Clic event to a button. It works with the code above:

ce = wx.CommandEvent(wx.EVT_RIGHT_ DOWN._getEvtType(),
i.GetId())

i.ProcessEvent(ce)

      i is the targeted

button.

      But there's an

error : as I use the Event to get information, with this
method the Event is None. How can I send a “proper” event ?

      Thank you for your

help,

Arnaud

  You received this message because you are subscribed to the Google

Groups “wxPython-users” group.

  To unsubscribe from this group and stop receiving emails from it,

send an email to wxpython-user...@googlegroups.com.

  For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
Define a class method with a type of Fn(self, evt) and in your

constructor bind the ex.EVT_RIGHT_DOWN for i to that method. You
can then access the event parameters using eve.param in your
function.

Gadget/Steve