Re: Programatically activate menu like a mouse click

2017-02-26 Thread John Lane
Ok, so I have made a little progress on this, albeit in a one step forward, two steps back kind-of way. This code in my `keybinder_callback` half-works: import Xlib from Xlib import X from Xlib.display import Display from Xlib.ext.xtest import fake_input display =

Re: Programatically activate menu like a mouse click

2017-02-24 Thread Colomban Wendling
Le 24/02/2017 à 10:24, John Lane a écrit : > On 23/02/17 21:02, Colomban Wendling wrote: > >> >> Sounds odd to do that manually. Do you know about mnemonic keys? >> Basically if you mark some part of the label to be the mnemonic letter, >> you'll be able to trigger that element with Alt+letter. >

Re: Programatically activate menu like a mouse click

2017-02-24 Thread John Lane
On 23/02/17 21:02, Colomban Wendling wrote: > > Sounds odd to do that manually. Do you know about mnemonic keys? > Basically if you mark some part of the label to be the mnemonic letter, > you'll be able to trigger that element with Alt+letter. > > Additionally, F10 already pops up the first me

Re: Programatically activate menu like a mouse click

2017-02-24 Thread John Lane
> Give this a try. It might be close to what you are after. Thanks Eric. That works, however it is slightly different to what I need. Firstly, my app is a dock containing nothing but a menu bar, so it has no "window" as such. Secondly, its key binding only works when its window has the focus. I

Re: Programatically activate menu like a mouse click

2017-02-23 Thread Colomban Wendling
Le 23/02/2017 à 15:57, John Lane a écrit : > […] > > The UIManager provides the menu bar, a few items in the bar each leading > to menus containing a few items. The user can click operate the menu > with a mouse and selecting a menu item triggers a callback that prints > the name of the selected i

Re: Programatically activate menu like a mouse click

2017-02-23 Thread Eric Cashon via gtk-app-devel-list
Hi John, Give this a try. It might be close to what you are after. Eric #!/usr/bin/python import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk, Gdk class MainWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="Menu Popup")

Re: Programatically activate menu like a mouse click

2017-02-23 Thread John Lane
On 23/02/17 15:23, Norbert de Jonge wrote: > I would guess with: > https://developer.gnome.org/gtk3/stable/GtkMenu.html#gtk-menu-popup-at-widget Thanks, I have 3.22.5. I had tried `gtk-menu-popup-at-widget` but it didn't work. I've tried lots of combinations to try and get it to work without succ

Re: Programatically activate menu like a mouse click

2017-02-23 Thread Norbert de Jonge
> How can I trigger the menu activation (like a mouse click does) ? I would guess with: https://developer.gnome.org/gtk3/stable/GtkMenu.html#gtk-menu-popup-at-widget It's available for GTK+ 3.22 and up, so I cannot test it to verify. This should tell you your GTK+ version: $ pkg-config --modversi

Programatically activate menu like a mouse click

2017-02-23 Thread John Lane
I am trying to write a small test app using Python and Gtk+3 It's basically a bar across the top of the display that contains a menu implemented as a Gtk.Window containing a Gtk.Bar containing a menu bar populated using UIManager. Essentially this (where 'self' is an object derived from `Gtk.Windo