What is the format of the parameter activate_time
in Python GTK+ when using Gtk.Menu.popup()
method?
I have tried using int(time.time())
but I get a traceback saying an integer is required...
What is the format of the parameter activate_time
in Python GTK+ when using Gtk.Menu.popup()
method?
I have tried using int(time.time())
but I get a traceback saying an integer is required...
Not sure if it is a complete solution, but time.time()
returns a float, try casting to an int and see what happens.
EDIT: After consulting the source docs, I found this tidbit:
The button and activate_time values should be the mouse button that was pressed to trigger the menu popup and the time the button was pressed. These values can usually be retrieved from the "button_press_event".
Perhaps this will be more helpful than my first attempt.
I also found this C snipet in the C docs, it has popup()
being called in a signal handler (that is how they get a "button_press_event".
I found out I can use gtk.get_current_event_time()
to get a reasonable timestamp matching what Gtk looks like it expects.