Submenu problem.. Discrepancy between Linux and Windows

Recently I have a trouble with a discrepancy between the Linux system
and the Windows 7.

The matter is binding the menu event to a “sub-menu” for dynamically generated context menu.

(wxpython 3.0.2 generated from the source)

If I bind the event using bind method of the sub-menu instance, it works in Linux.

it works in Linux well, but never in Windows

def func(evt):

print “It works!”, evt

base=wx.Menu()

self.AppendMenu(wx.NewId(), “Test submenu”, base)

mmi = wx.MenuItem(base, wx.NewId(), “Check event”) #putting a menu item to the sub-menu instance “base”

base.AppendItem(mmi)

base.Bind(wx.EVT_MENU, func, mmi) #binding event into the sub-menu instance “base”

---------------------------------------------------

But, it doesn’t work in Windows (64 bit, 3.0.0, included in Anaconda).

I should bind into the parent menu instance, instead of submenu.

it works in Windows …

def func(evt):

print “It works!”, evt

base=wx.Menu()

self.AppendMenu(wx.NewId(), “Test submenu”, base)

mmi = wx.MenuItem(self, wx.NewId(), “Check event”) #putting a menu item to the parent menu instance “self”

base.AppendItem(mmi)

self.Bind(wx.EVT_MENU, func, mmi) #binding event into the parent menu instance “self”

---------------------------------------------------

Is that a bug or dependence?

I attache the full code of this example.

Many thanks.

testwx.py (2.04 KB)