Windows system tray popups using Python

I modified Simon Brunning’s epic example (original can be found here) to include an example of how to have a windows system tray icon display a popup on demand. Here’s the coding:

https://docs.google.com/document/d/1xySFrLgSAiTfymgCQvW4bpsva_rzkwOqkcsoYWhN0a0/edit?usp=sharing

 

The differences are:

  • Added a new method to the sysTrayIcon class called “set_popup”. This is where win32 api does it’s magic and calls up a popup.
  • Note that “set_popup” makes use of two variables defined in the __init__ method (self.popup_title and self.popup_msg), the names of the variables are self explanatory. These two variables are set when instantiating the sysTrayIcon class in the very last line of the script, feel free to change these
  • I substituted one of the menu options (in menu_options) with the line: (‘Show Popup’, None, icon_popup)
  • Icon_popup is a caller method, accessed by the menu option I mentioned above,  which calls the “set_popup” method of the “sysTrayIcon” class

End result:

 

Selection_032

Selection_032

Advertisements

3 thoughts on “Windows system tray popups using Python

  1. Thanks David. You right Simon Brunning’s example is epic. Nice idea to add the popup. Is there a way to add an ‘on click’ event to the popup? (and/or the icon it’s self)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s