summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorGustavo J. A. M. Carneiro <gjc@src.gnome.org>2006-11-19 23:29:33 +0000
committerGustavo J. A. M. Carneiro <gjc@src.gnome.org>2006-11-19 23:29:33 +0000
commit7fb542ec86783d525a112e0c51fe587b52f409ba (patch)
treee93a8cbc4ba622147f4b30a27fa4074f733691cc /examples
parent389394cd0ec4040eb7d5885bfce124fbe1c42585 (diff)
downloadpygtk-7fb542ec86783d525a112e0c51fe587b52f409ba.tar.gz
status icon demo, by Nikos Kouremenos
Diffstat (limited to 'examples')
-rw-r--r--examples/Makefile.am1
-rw-r--r--examples/pygtk-demo/demos/statusicon.py31
2 files changed, 32 insertions, 0 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 8805ad43..2407b296 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -83,6 +83,7 @@ demo_PYTHON = \
pygtk-demo/demos/textview.py \
pygtk-demo/demos/tree_store.py \
pygtk-demo/demos/treemodel.py \
+ pygtk-demo/demos/statusicon.py \
pygtk-demo/demos/ui_manager.py
demoimg_DATA = \
diff --git a/examples/pygtk-demo/demos/statusicon.py b/examples/pygtk-demo/demos/statusicon.py
new file mode 100644
index 00000000..53564a81
--- /dev/null
+++ b/examples/pygtk-demo/demos/statusicon.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+'''Status Icon
+
+This is a simple example that shows how to create a status icon that
+will appear in the "notification area" in GNOME/KDE, or "system tray"
+in Windows.
+'''
+## Author: Nikos Kouremenos
+
+import gtk
+
+
+def make_menu(event_button, event_time, icon):
+ menu = gtk.Menu()
+ item = gtk.MenuItem('hi')
+ item.show()
+ menu.append(item)
+ menu.popup(None, None,
+ gtk.status_icon_position_menu, event_button,
+ event_time, icon)
+
+def on_right_click(icon, event_button, event_time):
+ make_menu(event_button, event_time, icon)
+
+def StatusIconDemo(parent=None):
+ icon = gtk.status_icon_new_from_stock(gtk.STOCK_QUIT)
+ icon.connect('popup-menu', on_right_click)
+
+if __name__ == '__main__':
+ StatusIconDemo()
+ gtk.main()