What's the enum for a button press event in pygobject 3?

MRAB python at mrabarnett.plus.com
Thu Jul 30 10:50:40 EDT 2020


On 2020-07-30 11:09, Chris Green wrote:
> I am going round and round in steadily increasing frustration trying
> to find the constants for button events in Pygobject/Gtk 3.
> 
> I have the following imports:-
> 
>      import gi
>      gi.require_version('Gtk', '3.0')
>      from gi.repository import Gtk
>      from gi.repository import Gdk
> 
> 
> The old GTK 2 code had (I think):-
> 
>      if (event.type == gtk.gdk.BUTTON_PRESS):
> 
> 
> So what is BUTTON_PRESS in the new version, I simply can't find a
> straightforward description of it or example of its use.
> 
> 
I believe it's:

Gdk.EventType.BUTTON_PRESS

There's documentation here:

https://lazka.github.io/pgi-docs/#Gdk-3.0/enums.html#Gdk.EventType.BUTTON_PRESS


More information about the Python-list mailing list