PyQt, main window can't have reference to application class
Sibylle Koczian
Sibylle.Koczian at Bibliothek.Uni-Augsburg.de
Tue May 25 02:26:31 EDT 2004
Phil Thompson schrieb:
> On Monday 24 May 2004 3:54 pm, Sibylle Koczian wrote:
>
>>Still trying to learn PyQt from a book about several Python GUI
>>toolkits, I seem to learn first what doesn't work. The following small
>>script seems to work, but after closing the window I get the error
>>message "Fatal Python error: PyEval_RestoreThread: NULL tstate".
>
>
> You have created a circular reference which won't help. The problem doesn't
> occur if PyQt is built with SIP v4 - it uses the newer Python thread API.
>
But the circular reference would remain, wouldn't it? I still don't see
a way around it: the main window must know about the GUI independent
methods of the application, and those methods should be able to exchange
data with the main window. But I still want to keep the GUI independent
things separate.
>
>>Without the line "self.app = app" the error goes away. So I suppose the
>>main window can't have a reference to the application class. Right?
>>Using the global variable qApp instead of self.app doesn't work either:
>>qApp seems to be an instance of QApplication, not an instance of HelloApp.
>
>
> It's the same C++ instance, but they are different types. knopftext is an
> attribute of the HelloApp type. qApp is of type QApplication.
>
That's what I meant.
Thank you,
Koczian
--
Dr. Sibylle Koczian
Universitaetsbibliothek, Abt. Naturwiss.
D-86135 Augsburg
Tel.: (0821) 598-2400, Fax : (0821) 598-2410
e-mail : Sibylle.Koczian at Bibliothek.Uni-Augsburg.DE
More information about the Python-list
mailing list