[Pythonmac-SIG] Tkinter problem in a forked
Eric Texier
erictexier at sbcglobal.net
Sat Jun 4 17:05:05 CEST 2005
Hi,
I am having trouble with running tk in a child process. the code worked
on linux.
It crashed with the following message:
creating window in receptionist
Tcl_FinalizeNotifier: notifier pipe not initialized
Abort
Any idea if it's a bug or something extra that I need to do of macox.
Thanks,
Eric
import os, sys
from Tkinter import *
class receiver:
def __init__(self, pipeFromParent):
try:
print "creating window in receptionist"
Tk(className='foork',screenName = None,baseName = None)
print "creating window in receptionist DONE"
except:
sys.exit(1)
tkinter.createfilehandler(pipeFromParent,tkinter.READABLE,self.msgFromParent)
self.Frame = Frame()
self.Frame.master.protocol("WM_DELETE_WINDOW", self.quit)
self.Frame.mainloop()
def quit(self):
print "in quit"
def msgFromParent(self,file=None,mask=None):
print "in msgFromParent file: ",file," mask: ",mask
sys.exit(0)
def startReceiver():
pipeReceiver = os.pipe()
pid = os.fork()
if pid == 0:
# child process
os.close(pipeReceiver[1])
receiver(pipeReceiver[0])
sys.exit(0)
# parent process
os.close(pipeReceiver[0])
return pipeReceiver[1]
pipeReceiver = startReceiver()
win = Tk(className = "main")
win.mainloop()
More information about the Pythonmac-SIG
mailing list