i have a small application. I want my target users(windows,linux) to be able to start and exit the application from the system tray. I intend to use Tkinter because of its low footprint but, i dont know how to implement it.
Can tkinter do this or are there better alternatives. I need a GUI library that won't change my 1MB program to a 5MB program.
Please sample codes will be appreciated
Thanks
To create a System Tray icon of a tkinter application, we can use pystray module in Python. It has many inbuilt functions and methods that can be used to configure the system tray icon of the application. To install pystray in your machine, you can type "pip install pystray" command in your shell or command prompt.
In Windows 10 On Windows 10, you can access more detailed setting by right-clicking the taskbar and selecting “Settings”. This takes you straight to the Settings > Personalization > Taskbar screen. Scroll down to the “Notification Area” section and click the “Select which icons appear on the taskbar” link.
mainloop() tells Python to run the Tkinter event loop. This method listens for events, such as button clicks or keypresses, and blocks any code that comes after it from running until you close the window where you called the method.
I don't know any direct examples but I found a TCL/Tk extension to use the systray over here http://wiki.tcl.tk/4090 and a page on the wiki giving information on how to use TCL/Tk extensions from Tkinter.
On a more general note, you might want to consider using a more "advanced" toolkit (like wx) that provides things like systray usage etc. natively.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With