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:


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:





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

Please log in using one of these methods to post your comment: Logo

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

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.