473,405 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

[HELP] Tkinter Application Minimized to System Tray :)

I write a program with Python 2.4 + Tkinter
Execute it, there will be a window show something.
If I minimize it, it will be minimized to the taskbar. But I would like
it to miniminze to the System Tray, this can make taskbar more clear. Would
you please tell me how to modify my program.

Thanks a lot !!

Soure Code :

# Display digits of pi in a window, calculating in a separate thread.
# Compare with wpi.py in the Demo/threads/wpi.py

import sys
import time
import thread
from Tkinter import *

class ThreadExample:
def __init__(self, master=None):
self.ok = 1
self.digits = []
self.digits_calculated = 0
self.digits_displayed = 0
self.master = master

thread.start_new_thread(self.worker_thread, ())

self.frame = Frame(master, relief=RAISED, borderwidth=2)
self.text = Text(self.frame, height=26, width=50)
self.scroll = Scrollbar(self.frame, command=self.text.yview)
self.text.configure(yscrollcommand=self.scroll.set )
self.text.pack(side=LEFT)
self.scroll.pack(side=RIGHT, fill=Y)
self.frame.pack(padx=4, pady=4)
Button(master, text='Close', command=self.shutdown).pack(side=TOP)

self.master.after(100, self.check_digits)

def worker_thread(self):
while self.ok:
self.digits.append(`9`)
time.sleep(0.001)

def shutdown(self):
self.ok =0
self.master.after(100, self.master.quit)

def check_digits(self):
self.digits_calculated = len(self.digits)
diff = self.digits_calculated - self.digits_displayed
ix = self.digits_displayed
for i in range(diff):
self.text.insert(END, self.digits[ix+i])
self.digits_displayed = self.digits_calculated
self.master.title('%d digits of pi' % self.digits_displayed)
self.master.after(100, self.check_digits)

root = Tk()
root.option_readfile('optionDB')
example = ThreadExample(root)
root.mainloop()

__________________________________________________ _______________
Ãâ·ÑÏÂÔØ MSN Explorer: http://explorer.msn.com/lccn/

Jul 19 '05 #1
0 2479

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Greg Merideth | last post by:
Is there a way via c# to hook a system tray application into the windows keyboard que globally so that when the application is running and you press, say, control-alt-shift-f11 the system tray app...
3
by: ASP .NET Newbie | last post by:
Hey everyone, I have an application that I am developing (well, that's obvious!). The application minimizes to the system tray when it is minimized. I have a function called Show_Click() that...
3
by: Claire | last post by:
Windows refuses to close down if my applications main form is hidden and there's a notify icon in the system tray. If I restore the form, then shutting down Windows succeeds. If I comment out the...
3
by: Lumpierbritches | last post by:
I have an application my partner wrote that would allow an autoresponse to any Mapi compliant email that apparently in .Net won't, can someone assist me with fixing this? Here is the code: ...
2
by: shivaranjani.s.adimulam | last post by:
Hi, I have a .NET application where I want to restore the previos application if it is already running and in minimized state. The code I added is working fine in the case if the previous...
0
by: shivaranjani.s.adimulam | last post by:
Hi, I have a .NET application where I want to restore the previos application if it is alreay running and in minimzed state. The code I added is working fine in the case if the previous...
8
by: Avi G | last post by:
Hi, i've created an application and i want it to be minimized to the sys tray, how i do it? if you can direct me step by step even with create a small application and put it in the sys tray ...
6
by: Avi G | last post by:
Hi, i've this code that minimize application to sys tray i managed to hide the application to the sys tray but i don't know how to bring it up back by double cliking the sys tray icon this is...
10
by: nagar | last post by:
I noticed this behavior in a C# application. For its nature the applications stays mainly minimized to the tray icons As soon as it's launched the application responds normally. After a while,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.