Problem in _tkinter.c with extending both tk and python with C++
Bernhard Herzog
herzog at online.de
Thu Jun 22 07:13:25 EDT 2000
More information about the Python-list mailing list
Thu Jun 22 07:13:25 EDT 2000
- Previous message (by thread): Problem in _tkinter.c with extending both tk and python with C++
- Next message (by thread): Python class tree viewer (with wxPython)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Jyrki Alakuijala <Jyrki.Alakuijala at mail.dosetek.varian.com> writes: > I have an old python/tkinter application that used to work fine > with Python 1.4 and 1.5. Roughly one year ago it got > broken. The application is mostly C++ and Python with some > "embedded" tcl. Now, with 1.5.2 the program crashes > similarly in both Windows NT and Linux environments. > > The problem occurs with the following pattern: > First, I load a (self-made) tk widget as a dynamic library. > > Second, I load the (self-made) python extensions as dynamic > libraries. > > Third, I make an operation in the user interface that > starts as a Tk-event, going to python. Python updates > my widget, which calls C++ code, which calls > (Tcl_VarEval) which tries to visit Python code. > This is when the program crashes. > > The error message it gives before termination is: > Fatal Python error: PyEval_RestoreThread: NULL tstate > > I believe this has something to do with the thread > safety of tkinter (ENTER_PYTHON and > LEAVE_PYTHON). Perhaps I should take these > macros into my code for visiting Tcl code from C++. > However, I cannot get access the Tcl-lock declared in > _tkinter.c, because it is static. That's exactly what happens in _tkinter in Python 1.5.2. My drawing program Sketch was broken by this change when 1.5.2 came out last year, too. Unfortunately, by the time I figured out what was happening it was too late to make any more changes to Python. > What should I do to get the code working with > newer releases of Python? Should I give up with > Tk and move to one of the newer UI libraries? > Should I write my own _tkinter.c? My solution was to distribute a modified _tkinter with Sketch and import it instead of the standard one. -- Bernhard Herzog | Sketch, a drawing program for Unix herzog at online.de | http://sketch.sourceforge.net/
- Previous message (by thread): Problem in _tkinter.c with extending both tk and python with C++
- Next message (by thread): Python class tree viewer (with wxPython)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list