开发者

Format of activate_time in Gtk.Menu

What is the format o开发者_如何学JAVAf 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜