473,799 Members | 3,276 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[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_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/

Jul 19 '05 #1
0 2530

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

Similar topics

1
3714
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 could respond to that keypress (much in the way my pgp app encrypts on ctrl-alt-e) even though its minimized and your in a different app? I've got an app thats a system tray and while its easy to access the data I'm just trying to add an extra...
3
1426
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 is part of the context menu of the tray icon. Here's the dilemma I face. I only want to allow 1 instance of the program (I've already done that), and have the "original" process show back up on the screen. The problem is, if it is already on...
3
2953
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 code in "frmOptions_Closing" then run and hide the application, Windows shuts down normally. I think there was a way to find out what was causing an application to close down - api call? Is there anything in .net that I can query My code is...
3
2927
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: Utilities Module: Option Explicit Option Base 1
2
298
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 application is only minimized but if it is minimized in to the system tray then the code fails.
0
903
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 application is only minimized but if it is minimized in to the system tray then the code fails.
8
4550
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 Thanks
6
1280
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 the code for the hide private void SysTrayIcon_MouseDoubleClick(object sender, MouseEventArgs e)
10
2191
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, when I double click on the tray icon to show the window or I type a shortcut to open a new dialog (which also contains third-part controls) it takes much longer to open (even 3-5 seconds). How is that? Is there a way to avoid this behavior and keep...
0
9541
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10484
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10228
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10027
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9072
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.