[Tkinter-discuss] pb with tcl / tk under win2000

francesco.grillo at ciaolab.com francesco.grillo at ciaolab.com
Wed Oct 13 17:01:47 CEST 2004



Hi to all ,
i have a blocking pb .
I use python 2.3 with tk/tcl 8.4.7 under windows2000;i wrote an application
that in the begining
under window systems was very instable , frequently crashed now and then
without a reason .
I found out that recompiling the tcl / tk libraries with "TCL_THREADS=1"
flag
these instability went away . Unfortunatelly there is a side effect that
is :
Memory allocation grow each time a call to tk is done .
Since my application heavly use tk and is supposed to stay on days and days
without shuting down , what it happens is that, after a while the memory
used by
applications is increased by Megas .
Below i wrote a very simple .py that demostrates how is easy to grab memory
from the system just calling the bell method in an infinite loop .

Thank for the help , Francesco Grillo




from Tkinter import *
import threading
import time
import gc
import os

class Ticker:
    def __init__(self):
        self.l = Label(text="W")

        print 'init '
    def start(self):
        self.thread = threading.Thread(target=self.tickerThread)
        self.thread.start()

    def tickerThread(self):
        while(1):
            self.l.bell()

root = Tk()
root.geometry("200x150+0+0")
ticker1 = Ticker()
ticker1.start()
root.mainloop()




More information about the Tkinter-discuss mailing list