Differences
This shows you the differences between two versions of the page.
dev:howto:panel-plugins [2008/02/17 14:23] – created - added hello-world example from goodies-dev m/l stephan | dev:howto:panel-plugins [2008/02/17 14:31] (current) – removed stephan | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Creating Panel Plugins ====== | ||
- | There are several ways to write a panel-plugin for the xfce4-panel. | ||
- | ===== Examples ===== | ||
- | |||
- | ==== C-code Example ==== | ||
- | |||
- | ==== Python (PyXfce) Example ==== | ||
- | |||
- | # Hello World example | ||
- | # External libraries | ||
- | import gtk # use gtk-library | ||
- | import xfce4.panel | ||
- | | ||
- | # Button with status icon and menu plopping up on clicking it | ||
- | button = gtk.Button( "Hello World" ) | ||
- | button.show() | ||
- | | ||
- | # create an xfce panel plugin | ||
- | plugin = xfce4.panel.Plugin() | ||
- | | ||
- | plugin.add( button ) | ||
- | | ||
- | # Add right mouse button action | ||
- | plugin.add_action_widget( button ) | ||
- | | ||
- | # Show plugin | ||
- | plugin.show() | ||
- | | ||
- | # Close plugin on destroy | ||
- | plugin.connect(" | ||
- | | ||
- | # Ready. Start plugin | ||
- | gtk.main_loop() |