Last active
December 4, 2017 00:20
-
-
Save jrosco/429b97be048e60ad02ab to your computer and use it in GitHub Desktop.
Gtk icon popup gtk.window
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import gtk | |
class StatusIcon: | |
def __init__(self): | |
self.statusicon = gtk.StatusIcon() | |
self.statusicon.set_from_stock(gtk.STOCK_HOME) | |
self.statusicon.connect("popup-menu", self.right_click_event) | |
self.statusicon.set_tooltip("StatusIcon Example") | |
self.popup_open = False | |
self.builder_file = "../gui/menu_popup_test.glade" | |
self.builder = gtk.Builder() | |
self.builder.add_from_file(self.builder_file) | |
self.builder.connect_signals(self) | |
self.popup_dialog = self.builder.get_object('window1') | |
self.popup_dialog.set_keep_above(True) | |
def right_click_event(self, icon, button, time): | |
print 'rightclick' | |
if self.popup_open is False: | |
self.popup_open = True | |
self.popup_dialog.show_all() | |
else: | |
self.popup_dialog.hide() | |
def close_pop_menu(self, widget, event): | |
print 'out of focus %s' % widget | |
self.popup_open = False | |
self.popup_dialog.hide() | |
StatusIcon() | |
gtk.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment