[PyQt] PyQt-Tkinter problem : PyEval_RestoreThread: NULL tstate

Rajorshi Biswas rajorshi_iiitc at yahoo.com
Thu Jan 22 16:35:58 GMT 2009


Hello all!

This is my first post in this forum, am really hoping that you guys could help me out. 

I have a PyQt mainwindow app that calls a Tk widget containing a listbox. When I try to resize the Tk widget to a dimension lesser than the size of the listbox (ie make it smaller vertically or horizontally), then the app crashes.

To give you a better idea, here is the code for the mainwindow app:

################ pyqt.py ##################################

import sys
from PyQt4 import QtGui

class MainWindow(QtGui.QMainWindow):
    def __init__(self):
        QtGui.QMainWindow.__init__(self)

        self.resize(250, 150)
        self.setWindowTitle('statusbar')

    self.showPanel()
    
    def showPanel(self):
    import tkPanel
    tkPanel.tkPanel()
        
app = QtGui.QApplication(sys.argv)
main = MainWindow()
main.show()
sys.exit(app.exec_())

######################################################

And here is the Tkinter widget:

################### tkPanel.py #########################

#import sys
#sys.argv = [''] 
import Tkinter as origTk

def tkPanel():

    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=scrollbar.set)
       
    scrollbar.config(command=list.yview)
    scrollbar.pack()
    list.insert(0,"ABCD")
    list.insert(1,"ABCD-1")
    list.insert(2,"ABCD-2")
    list.pack()

    window.update()

#######################################################


Now if I run this, using: python pyqt.py, and then drag/resize the Tk widget 
to a height less that the list size, then it crashes with the message:

Fatal Python error: PyEval_RestoreThread: NULL tstate


Could you please let me know if you spot any problems in the above code? Or what is it that causes this particular problem in general?

Thanks a lot in advance,
Raj


 ~Raj
http://rajorshi.co.cc



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090122/6a1c5f59/attachment.html


More information about the PyQt mailing list