Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tkinter: How to make a system tray application?

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

like image 847
Kennedy Avatar asked Dec 08 '10 08:12

Kennedy


People also ask

How do I create a system tray application in Python?

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.

How do I create a system tray icon?

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.

What does Mainloop () do in tkinter?

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.


1 Answers

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.

like image 110
Noufal Ibrahim Avatar answered Sep 19 '22 15:09

Noufal Ibrahim