[Qt-interest] Calling Tk panels from Qt apps
Rajorshi Biswas
rajorshi at in.com
Mon Jan 26 15:03:34 CET 2009
Hi, Our application consists of a large number of Tk panels (written in Pythontk) and we are slowly moving towards Qt. The main window is written in Qt, but currently we have to invoke a number of Tk panels from the main Qt code. Hence we have tried code such as this using the CPython APIs:// In main Qt codeconnect(button, SIGNAL(pressed()), this, SLOT(showPythonPanel()));// and the function that opens the tk widgetvoid MainWindow::showPythonPanel() {PyRunSimpleString( "import tkPanel
" );PyRunSimpleString( "tkPanel.showTkPanel()
" );}This is causing a lot of problems. Specifically, when we try to resize the Tk panel, we get crashes with the following message:" Fatal Python error: PyEvalRestoreThread: NULL tstate "I know this is perhaps not the ideal forum for this, but we've searched for help elsewhere without much avail. We want to know if we are doing the right thing, or if there isa better way for such requirements.For reference, I've attached the code for our Tk panel below this email.Your help would be greatly appreciated!Thanks,Rajhttp://www.rajorshi.net/blog Code for TK panel:import Tkinter as origTkimport toyModuledef toyTkPanel():window = origTk.Tk()window.title("Toy Program")## Create the main container i.e. topmost frame (a Tkinter Frame)frameDesc = origTk.Frame(window)frameDesc.pack()## Create Scrollbar for descriptor listbox ( a Tkinter Scrollbar)scrollbar = origTk.Scrollbar(frameDesc) ## Create descriptor Listbox ( a Tkinter Listbox) list = origTk.Listbox(frameDesc,yscrollcommand=scroll
bar.set) scrollbar.config(command=list.yview)scrollbar.pack()list.insert(0,"ABCD")list.insert(1,"ABCD1")list.insert(2,"ABCD2")list.insert(3,"ABCD=4")list.insert(4,"ABCD5")list.pack()window.mainloop()Rajhttp://www.rajorshi.net/blogDear qtinterest! Get Yourself a cool, short @in.com Email ID now!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090126/77f3c41b/attachment.html
More information about the Qt-interest-old
mailing list