[PyKDE] Python und GUI-Toolkits

Phil Thompson phil at riverbankcomputing.co.uk
Wed Jun 2 14:54:00 BST 2004


On Wednesday 02 June 2004 11:20 am, Sibylle Koczian wrote:
> Dear Mr. Lauer,
>
> <shameless self-promotion>
>
> Did you try reading "Python und GUI-Toolkits"? This one aims at giving
> you some background to how event driven programs work, what makes a
> GUI-Toolkit at all etc. It contains a presentation of a "full-fledged"
> application which is layed out GUI-Toolkit independent in the core and
> than later on finished with
>
>   * wxWidget
>   * PyGTK
>   * PyQt
>   * Tkinter
>
> </shameless self-promotion>
>
> Very glad to see you're in this list. I've got the book, did part of the
> Tkinter version of the application a while ago, but run into difficulties
> with the Qt version. After closing the application as it is in step 1a, I
> get the message: "Fatal Python error: PyEval_RestoreThread: NULL tstate".
> It seems the circular reference (from the application instance to its main
> window and from the main window back to the application) is responsible,
> but I don't see a really good way around it.
>
> Moreover in my own application I'd like to use a new style application
> class, and with the current version of PyQt/SIP it's not possible to derive
> a class from QApplication and from a new style class.
>
> At the moment I've got Python 2.3.3, PyQt 3.11.17, SIP 3.10.1.16, Qt
> 3.3.1-36.5, running under SuSE Linux 9.1. I hear SIPv4 should solve both
> problems, but I don't see how that update can get round the fact of the
> circular reference.

The circular reference is not the root cause, but is triggering a thread/GIL 
related problem when the interpreter is closing down. SIP v4 uses a different 
thread API which avoids the problem.

Phil




More information about the PyQt mailing list