[pygtk] Submenu not getting focus

Dieter Verfaillie dieterv at optionexplicit.be
Sat Dec 30 21:47:09 WST 2006


On Fri, 2006-12-29 at 13:11 -0800, Ian Larsen wrote:
> Hello all,
> 
> I believe I've encountered a bug in pygtk.  When creating a context
> menu with a submenu, the submenu doesn't get focus until the menu item
> it's attached to is clicked (even though the submenu appears when the
> mouse is over the menu item.)
> 
> The upshot is that items in the sub menu don't emit the activate
> signal unless the parent menu item is clicked first.
> 
> Here is some test code demonstrating this problem:

Hi,

I've done a quick test with the following results.
What works:
  right click on label, right click on submenu item
  left click on label, left click on submenu item
  middle click on label, middle click on submenu item

What doesn't work:
  right click on label, left click on submenu item
  etc

To solve this you should replace:
>        evbox.connect('button-release-event', self.contextMenu)

with:
       evbox.connect('button-press-event', self.contextMenu)

HTH,
Dieter



More information about the pygtk mailing list