The Following 2 Users Say Thank You to Xagoln For This Useful Post: | ||
|
2016-08-19
, 09:12
|
Posts: 262 |
Thanked: 315 times |
Joined on Jun 2010
|
#2
|
menu = gtk.Menu() # "Emulate" hildon_gtk_menu_new (makes the menu larger # and easier to use with finger) menu.set_name('hildon-context-sensitive-menu') menu_item = gtk.MenuItem(_('Edit')) menu.append(menu_item) menu_item.connect('activate', self.activated, self.treeview) menu.show_all() treeview.tap_and_hold_setup(menu)
The Following 4 Users Say Thank You to Xagoln For This Useful Post: | ||
I know Qt is what everybody uses now, but I've started developing an app in PyGTK and am quite enjoying it.
However, I'm a bit stuck with trying to detect and handle longpresses on GTK TreeView rows.
I have cobbled together code from Modrana (thanks MartinK!) with examples from around the web (mostly PyGTK doco).
Basically I have connected the button-press-event and button-release-events for the treeview to two methods, and I've managed to get a context menu to display on a longpress on an item, but I'm having difficulty getting the menu to go away when the finger is lifted from the screen, and the menu also weirdly follows the finger around the screen as it moves.
Can anybody recommend other PyGTK apps I should inspect for examples of longpress popup menus, or spare some time to look at my code and give some guidance?