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_cal culated = 0
self.digits_dis played = 0
self.master = master
thread.start_ne w_thread(self.w orker_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.te xt.yview)
self.text.confi gure(yscrollcom mand=self.scrol l.set)
self.text.pack( side=LEFT)
self.scroll.pac k(side=RIGHT, fill=Y)
self.frame.pack (padx=4, pady=4)
Button(master, text='Close', command=self.sh utdown).pack(si de=TOP)
self.master.aft er(100, self.check_digi ts)
def worker_thread(s elf):
while self.ok:
self.digits.app end(`9`)
time.sleep(0.00 1)
def shutdown(self):
self.ok =0
self.master.aft er(100, self.master.qui t)
def check_digits(se lf):
self.digits_cal culated = len(self.digits )
diff = self.digits_cal culated - self.digits_dis played
ix = self.digits_dis played
for i in range(diff):
self.text.inser t(END, self.digits[ix+i])
self.digits_dis played = self.digits_cal culated
self.master.tit le('%d digits of pi' % self.digits_dis played)
self.master.aft er(100, self.check_digi ts)
root = Tk()
root.option_rea dfile('optionDB ')
example = ThreadExample(r oot)
root.mainloop()
_______________ _______________ _______________ _______________ _____
Ãâ·ÑÏÂÔØ MSN Explorer: http://explorer.msn.com/lccn/