[Tkinter-discuss] How to dettach a Toplevel

Sorin Schwimmer sxn02 at yahoo.com
Thu Nov 30 19:11:16 CET 2006

After hitting "send" with John's answer I saw Matthias question. So here is my next answer:

Yes, it is a daemon "a la carte". It forks, os.setsid, forks, redirects sys.stdin and sys.stdout to /dev/null. The code resides in /etc/init.d and dependencies are taken care of.
But I don't think this should be a problem because the following works from the Python
prompt, as root, in screen 1, targeting screen 7 (where my KDE loads) which is under
<regular user> control:

>>> import sys
>>> from Tkinter import *
>>> sys.stdout=open('/dev/null','w')
>>> r=Tk(screenName=':0.0')
>>> Label(r,text='Gutten Tag!').grid()

My daemon does all kind of other things, and it does them well; my only issue is when I have to
break its silence and inform the user, in GUI, about issues that (s)he may need to take action.
My preferred approach was the one described here, my alternative was the dettached Toplevel
described in my first posting; I can't make none to work.

Thanks for suggestions,

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20061130/1666ad3c/attachment.htm 

More information about the Tkinter-discuss mailing list