[Paraview] Python scripts with PyQt4
Stefan Kroboth
ml at stefan-kroboth.com
Fri Apr 9 14:39:48 EDT 2010
Hello!
I've build a Gui in the QtDesigner and converted it into a *.py file using pyuic4. Then I wrote a small program which loads and shows this Window. This program works fine in Python 2.6 but fails in the ParaView python shell. Since I'm new to Qt I don't know where to look for help. Is it even possible to display custom Windows?
This is the code I tried (based on a tutorial):
import sys
from paraview.simple import *
from PyQt4 import QtCore, QtGui
from MITgui import Ui_MIT_Automator
class Qt_MIT_Gui(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_MIT_Automator()
self.ui.setupUi(self)
if __name__ == "__main__":
bla = QtGui.QApplication(sys.argv)
test = Qt_MIT_Gui()
test.show()
sys.exit(test.exec_())
1. The first problem is sys.argv. I solve that by assigning ["path to the script"] to it.
2. When 1. is solved, it gets stuck in the line "bla = QtGui.QApplication(sys.argv)". When I comment that line, it ...
3. ... gets to "QtGui.QWidget.__init__(self, parent)", where it gets stuck again. ParaView just doesn't do anything and has to be killed.
I tried a lot of things, which were mostly just random alterations (because of my lack of knowledge).
It would be very nice if someone could provide me a minimal example of how to load and display a Qt gui (if this is even possible).
Please excuse once again my bad englisch :)
Thanks,
Stefan
More information about the ParaView
mailing list