[wxPython] How do I construct a menu event?

I want to use wxPosteEvent to send a menu command to my applicaton.
The wxWindows docs indicate that menu events are a kind of wxCommandEvent,
but they do not seem to contain info in constructors for such events. If I
have an Event Id, can I construct a wxCommandEvent that is equivalent
to the event created by actually selecting the menu item corresponding
to that id? How?

Thanks, Parzival

I want to use wxPosteEvent to send a menu command to my applicaton.
The wxWindows docs indicate that menu events are a kind of wxCommandEvent,
but they do not seem to contain info in constructors for such events. If I
have an Event Id, can I construct a wxCommandEvent that is equivalent
to the event created by actually selecting the menu item corresponding
to that id? How?

        evt = wxCommandEvent(wxEVT_COMMAND_MENU_SELECTED)
        evt.SetId(id)

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

Robin, when I try to follow your advice below, I get an exception:

     exceptions.NameError: There is no variable named 'wxCommandEvent'

Can you clarify how to access the undocumented 'wxCommandEvent' constructor?

- Thanks, Parzival

···

----- Original Message -----
From: "Robin Dunn" <robin@alldunn.com>
To: <wxpython-users@lists.wxwindows.org>
Sent: Saturday, March 31, 2001 7:20 PM
Subject: Re: [wxPython] How do I construct a menu event?

        evt = wxCommandEvent(wxEVT_COMMAND_MENU_SELECTED)
        evt.SetId(id)

> evt = wxCommandEvent(wxEVT_COMMAND_MENU_SELECTED)
> evt.SetId(id)

Robin, when I try to follow your advice below, I get an exception:

     exceptions.NameError: There is no variable named 'wxCommandEvent'

Can you clarify how to access the undocumented 'wxCommandEvent'

constructor?

Um... It's in event.py which is imported by wx.py so if you did from
"wxPython.wx import *" like usual then it should be there.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

Oops!

I usually do that, but in this case I had copied code that imported
specific names from wxPython.wx. So sorry to misuse your time!

By the way, the constructed event works as I wanted, Thanks.

- Parzival

···

----- Original Message -----
From: "Robin Dunn" <robin@alldunn.com>
To: <wxpython-users@lists.wxwindows.org>
Sent: Monday, April 02, 2001 3:38 PM
Subject: Re: [wxPython] How do I construct a menu event?

Um... It's in event.py which is imported by wx.py so if you did from
"wxPython.wx import *" like usual then it should be there.