[Tkinter-discuss] TclStackFree Error

Trevor J. Christensen trevor at jcmanagement.net
Wed Feb 9 17:54:13 CET 2011


Under Windows XP, the following simple program crashes after 20 seconds
or so with the following error:
 
TclStackFree: incorrect freePtr. Call out of sequence?
 
It behaves the same under python 2.6 and python 2.7.
 
I suspect it has something to do with Tk/Tcl's multithreading model.  I
did discover that if you comment out the vertical scrollbar code, this
program will run fine.  I could use some help here in figuring out what
the problem is.
 
import threading, ttk, time
from Tkinter import *
EVENT = '<<EVENT>>'
class Monitor(threading.Thread):
    def run(self):
        while True:
            text.event_generate(EVENT)
            time.sleep(.5)
def on_event(*args):
    text.insert(END, time.ctime()+'\n')
    text.see(END)
root = Tk()
text = Text(root)
vbar = ttk.Scrollbar(root, orient=VERTICAL)
vbar['command'] = text.yview
text['yscrollcommand'] = vbar.set
text.grid(column=0, row=0, sticky=NSEW)
vbar.grid(column=1, row=0, sticky=NS)
root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
text.bind(EVENT, on_event)
worker = Monitor()
worker.start()
root.mainloop()

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20110209/86041727/attachment.html>


More information about the Tkinter-discuss mailing list