473,549 Members | 2,334 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

QuickTimeTcl and Python/Tkinter crash

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\t cl").)

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

import Tkinter

class Movie(Tkinter.W idget):
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.m peg")
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

Jul 18 '05 #1
3 2315
Mickel Grönroos <mi****@csc.f i> wrote in message news:<ma******* *************** *************** @python.org>...
All seems to work pretty fine until the
Tkinter application is closed, when the Python interpreter crashes with an
error of the following kind: [...] I reckon the problem is that Python holds on to a reference to
something inside QuickTimeTcl after the QuickTimeTcl movie widget has been
destroyed.
Sounds possible. Tkinter does automatically maintain a widget tree, so
the Movie widget may not be getting destroyed properly.
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?)
You might wish to try trapping the destroy event, and writing your own
exit routine that explicitly destroys the Movie object.

Reference: http://www.pythonware.com/library/tk...d-bindings.htm
(towards the bottom, "Capturing destroy events")

Changes (not tried or tested) below:
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\t cl").)

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

import Tkinter

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

def closing():
m.destroy() # will this work ? maybe "m = None" ?
root.destroy()
root = Tkinter.Tk()
root.protocol(" WM_DELETE_WINDO W", closing)
m = Movie(root, file="toaster.m peg")
m.pack()
root.mainloop()

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


Regards, Myles.
Jul 18 '05 #2
On Tue, 30 Mar 2004, Mickel Grönroos wrote:
("""The instruction at "0x6697c820 " referenced memory at "0x01681f1c ".
The memory could not be "written". Click on OK to terminate the
program""")


I might add that the error message that I get when Python crashes always
contains those same memory positions, i.e. it is allways an instruction at
"0x6697c820 " that references memory at "0x01681f1c ". This might not make a
difference though.

/Mickel G.

--
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


Jul 18 '05 #3
On Tue, 29 Mar 2004, Myles wrote:
You might wish to try trapping the destroy event, and writing your own
exit routine that explicitly destroys the Movie object.


I'm afraid writing an explicit destroy method did not do the trick. I
still get the same error. ("""The instruction at "0x6697c820 " referenced
memory at "0x01681f1c ". The memory could not be "written". Click on OK to
terminate the program""")

Here is the latest code (that still causes the crash):

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

import Tkinter

class Movie(Tkinter.W idget):
"""Wrapper class for QuickTimeTcl::m ovie."""
def __init__(self, parent, cnf={}, **kw):
"""Construc tor. Parameters the same as here:
http://hem.fyristorg.c om/matben/qt/htmldocs/movie.html"""
parent.tk.eval( 'package require -exact QuickTimeTcl 3.1')
Tkinter.Widget. __init__(self, parent, 'movie', cnf, kw)

def closing(m, r):
"""Test for destroying the movie and root window when clicking X."""
m.destroy()
m = None
r.destroy()

root = Tkinter.Tk()
m = Movie(root, file="toaster.m peg")
m.pack()
root.protocol(" WM_DELETE_WINDO W",
(lambda x=m, y=root: closing(x,y)))
root.mainloop()

## Tried the following too, but has not effect.
m = None
del m

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

Any ideas what to try next!?

/Mickel G.

--
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

Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
3195
by: Eric Brunel | last post by:
Hi all, I was creating a Tkinter widget in the style of the reversed tabs below Excel worksheets and I stepped in a serious problem: the code I made makes python crash with a seg fault, bus error or X11 BadGC error on both Solaris (2.6 and 2.7) and Linux (Mandrake 8.0); it doesn't crash on Windows. I tried to simplify the script, but I...
11
23517
by: Leo | last post by:
hi there for somebody who wants tostart small/medium GUI apps with python: what's the best toolkit: tkinter, wxPython or what? stability, ease of use and portability between mac and windows are the main criteria. thanks, leo
0
2146
by: SteveFerrigno | last post by:
Ok, firstly I’m really sorry if this is in the wrong place :( but anyway. I have created a program which I want to convert into a .exe so I use PY2EXE but even if I have saved the python file I created as a .pyw why does it still show a Command Prompt box when I run the .exe??? I can’t figure it out. If anyone at all could help ill be very...
1
2219
by: John Chambers | last post by:
Sp my latest adventure is attempting to use python's Tkinter module on a few machines. On my PB (OSX 10.3.9), I got the following confusing results: /Users/jc: python Python 2.3 (#1, Sep 13 2003, 00:49:11) on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import Tkinter Traceback (most recent call...
14
2650
by: Hendrik van Rooyen | last post by:
Hi, I get the following: hvr@LINUXBOXMicrocorp:~/Controller/libpython display.py UpdateStringProc should not be invoked for type font Aborted and I am back at the bash prompt - this is most frustrating, as there is no friendly traceback to help me guess where its coming from.
1
14571
by: ShambhuHubli | last post by:
Hi ! I am developing front end for some application using Python Tkinter. And I am new to this GUI development. In my application, I have to create buttons other than square or rectangle. I want buttons something like Oval(or any other shape). I searched a lot.. But could'nt get. If any of you know please help me out. Thanks in advance.
2
2903
by: ShambhuHubli | last post by:
Hi all ! I am developing GUI in Python Tkinter for one application. In this I have created one Text box. And I need to insert the text inside the text box directly in to some paticular line say 10th line, without inserting any '/n' before that line... For Example : text = Text(parent, height, width, .... ) # Creating Text widget...
2
2536
by: Russell Blau | last post by:
I have some Tkinter programs that I run on two different machines. On Machine W, which runs Python 2.5.1 on Windows XP, these programs run fine. On Machine H, which runs Python 2.5.1 on Windows XP, however, the same programs crash regularly. The crashes are not Python exceptions, but rather are reported by Windows as errors in pythonw.exe. ...
1
6205
by: alivip | last post by:
How to brows and select a directory of file by using python TKinter like brows to find attachment in email but I can select not only file but whole directory any help
0
7546
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7471
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7985
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7830
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5387
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5111
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3496
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1082
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
784
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.