title: How to add systemtray to python script?
body: <p>I want to add a systemtray to an existing python based project: <a href="https://github.com/piejanssens/premiumizer" rel="nofollow noreferrer">https://github.com/piejanssens/premiumizer</a></p>
  
  <p>How exactly do I need to do that? I am completely new to python and I am using it for the first time, just because I want to add a little feature to and existing script.</p>
  
  <p>What I want to achieve is that when the script is running that there should be a system tray icon which opens <a href="http://localhost:5000" rel="nofollow noreferrer">http://localhost:5000</a> if it is double clicked. And if it is right clicked there should be an Exit/Quit option.</p>
  
  <p>I have researched a bit and I think I could achieve it with one of these two scripts <a href="https://github.com/moses-palmer/pystray" rel="nofollow noreferrer">https://github.com/moses-palmer/pystray</a> or with <a href="https://github.com/Infinidat/infi.systray" rel="nofollow noreferrer">https://github.com/Infinidat/infi.systray</a> (I also read that infi.systray should be used because it is not dependent on pywin32 because it uses the ctypes library because that one is part of the standard Python library).</p>
  
  <p>So I tried to add this code for testing to the premiumizer.py file:</p>
  
  <pre><code>from infi.systray import SysTrayIcon
      def say_hello(systray):
          print "Hello, World!"
      menu_options = (("Say Hello", None, say_hello),)
      systray = SysTrayIcon("icon.ico", "Example tray icon", menu_options)
      systray.start()
  </code></pre>
  
  <p>But now the Console is closing itself immediately. How can I check what went wrong? Is an error log saved somewhere ?</p>
  
  <p>What do I need to do to make it work? Or is there an easier way for someone "stupid" like me ?</p>