[PyQt] Error while running PyQt programs
Algis Kabaila
akabaila at pcug.org.au
Sat Aug 21 12:07:05 BST 2010
On Saturday 21 August 2010 20:28:28 Phil Thompson wrote:
> On Fri, 20 Aug 2010 20:38:30 +0530, Vikas Mahajan
>
> <vikas.mahajan12 at gmail.com> wrote:
> > Hello to all.
> > I have compiled python-2.6.5, qt-4.6.3 and PyQt-x11-gpl-4.7.4 on my
> > RHEL5 linux machine. I am trying to run any PyQt program, program
> > exists with Error: "Segmentation fault".
> > Please tell me the reason of this error and how can I overcome from this
> > error.
> >
> > Thanks.
>
> > Below is the contents of sample files used by me:
> ...
>
> > File start.py-:
> >
> > import sys
> > from PyQt4 import QtCore, QtGui
> > from testwin import Ui_MainWindow
>
> > class StartQT4(QtGui.QMainWindow):
> ^^^^^^^^^^^
>
> > def __init__(self, parent=None):
> > QtGui.QWidget.__init__(self, parent)
>
> ^^^^^^^
>
> > self.ui = Ui_MainWindow()
> > self.ui.setupUi(self)
> >
> > if __name__ == "__main__":
> > app = QtGui.QApplication(sys.argv)
> > myapp = StartQT4()
> > myapp.show()
> > sys.exit(app.exec_())
>
> You might want to fix the above problem first.
>
> Phil
I think that at this stage I will put my version of program on the list,
though it is more than likely still faulty. It was renamed to "test.py" with
Qt Designer output test.ui which was "compiled" to ui_test.py:
#!/usr/bin/env python
# test.py - a perennial noob testing program
import sys
from PyQt4.QtGui import *
from ui_test import Ui_MainWindow
class StartQT4(QMainWindow, Ui_MainWindow):
def __init__(self, parent=None):
super(QMainWindow, self).__init__(parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
if __name__ == "__main__":
app = QApplication(sys.argv)
form = StartQT4()
form.show()
app.exec_()
It does cause reports of segmentation faults, but runs OK on my PC
kubuntu 10.03 OS.
I sent this directly to Vikas so as not to clutter the mailing list. Besides,
I am not at all confident in my old age that the little program is "fault
free". In future right or wrong I will send it all to the mailing list.
OldAl.
OldAl.
More information about the PyQt
mailing list