wxPython with unity in Ubuntu 11.04

Hi all,

In wxPython apps in Ubuntu 11.04 with Unity interface I have a strange
behavior if the app have a Bind in EVT_SIZE: it raises the EVT_SIZE
without stopping, without even I resize the window.

I modified the menu example from the wxpython demo (Core windows /
Controls -> Menu) adding a Bind to EVT_SIZE and the corresponding
callback:

self.Bind(wx.EVT_SIZE, self.OnSize)

def OnSize(self, evt):
    print "OnSize"
    evt.Skip()

Without I resized the Window it starts to print "OnSize" repeatedly
without stopping.

I pasted a code sample here http://paste.org/pastebin/view/30661 , but
in that sample it only raises EVT_SIZE when the mouse cursor is over
windows, again, without I resize the Window.

But if I export UBUNTU_MENUPROXY=0 before start the wxPython app that
behavior doesn't occurs. It raises EVT_SIZE only when I resize the
window, what is the correct behavior.

The wxPython used here is from Ubuntu repository, version 2.8.11. With
export UBUNTU_MENUPROXY=0 the app doesn't use the globalmenu, without
that it uses.

Is there something I have to set in the menubar to correct this
behavior? Is it a bug from Ubuntu? or wxPython?

Thanks!

Hi all,

In wxPython apps in Ubuntu 11.04 with Unity interface I have a strange
behavior if the app have a Bind in EVT_SIZE: it raises the EVT_SIZE
without stopping, without even I resize the window.

I modified the menu example from the wxpython demo (Core windows /
Controls -> Menu) adding a Bind to EVT_SIZE and the corresponding
callback:

self.Bind(wx.EVT_SIZE, self.OnSize)

def OnSize(self, evt):
     print "OnSize"
     evt.Skip()

Without I resized the Window it starts to print "OnSize" repeatedly
without stopping.

I think this is due to wxGTK trying to make room in the frame for the menubar and then GTK sending another event because it is trying to move the menubar, and then wxGTK is making room for the menubar again, and then... In other words, wxGTK doesn't yet know how to let the system put its menu on the global menubar.

I pasted a code sample here http://paste.org/pastebin/view/30661 , but
in that sample it only raises EVT_SIZE when the mouse cursor is over
windows, again, without I resize the Window.

But if I export UBUNTU_MENUPROXY=0 before start the wxPython app that
behavior doesn't occurs. It raises EVT_SIZE only when I resize the
window, what is the correct behavior.

The wxPython used here is from Ubuntu repository, version 2.8.11. With
export UBUNTU_MENUPROXY=0 the app doesn't use the globalmenu, without
that it uses.

Is there something I have to set in the menubar to correct this
behavior? Is it a bug from Ubuntu? or wxPython?

There has been some discussion lately about how to fix wxGTK for use with the global menubar so I think that this will be fixed in 2.8.12.

···

On 3/23/11 7:26 AM, tfmoraes wrote:

--
Robin Dunn
Software Craftsman