QuickTimeTcl and Python/Tkinter crash

Mickel Grönroos mickel at csc.fi
Mon Mar 29 05:14:22 EST 2004


Hi everybody,

I'm using QuickTimeTcl (3.1) to be able to play movie files in my Tkinter
application (Python 2.3.2) on Windows 2000. I was planning to write a
simple wrapper class, QuickTimeMovie, that would wrap up the QuickTimeTcl
Tcl extension as a Python class. All seems to work pretty fine until the
Tkinter application is closed, when the Python interpreter crashes with an
error of the following kind:

The instruction at "0x6697c820" referenced memory at "0x01581f1c". The
memory could not be "written". Click on OK to terminate the program.

When running the "same" code in Tcl, I do not get this error.

I reckon the problem is that Python holds on to a reference to
something inside QuickTimeTcl after the QuickTimeTcl movie widget has been
destroyed.

My questions are then:

1. Is there a way to force Python to get rid of references so the
problem mentioned above could be avoided? (I.e. some sort of forced
garbage collection?)

2. Am I totally off track, i.e. is there some logical explanation (and
straight-forward fix) to the error I am experiencing?

I wrote Mats Bengtsson (who maintains the QuickTimeTcl extension) about
this too, but I reckon the Python community might have a few tips and
tricks to share too.

Here is the sample code I'm using. (To try it out, you need to download
QuickTimeTcl and put it where Python can find it (e.g.
"C:\\Python23\tcl").)

--------------------------

import Tkinter

class Movie(Tkinter.Widget):
    def __init__(self, parent, cnf={}, **kw):
	parent.tk.eval('package require -exact QuickTimeTcl 3.1')
        Tkinter.Widget.__init__(self, parent, 'movie', cnf, kw)

root = Tkinter.Tk()
m = Movie(root, file="toaster.mpeg")
m.pack()
root.mainloop()

---------------------------

Thanks in advance,

Mickel Grönroos

--
Mickel Grönroos, application specialist, linguistics, Research support, CSC
PL 405 (Tekniikantie 15 a D), 02101 Espoo, Finland, phone +358-9-4572237
CSC is the Finnish IT center for science, www.csc.fi




More information about the Python-list mailing list