Le 20/09/10 11:42, Cyril Giraudon a écrit :
Modifications in the code don't make things nicer :-( :
Sorry for not reporting the system characteristics :
(sandbox)cy...@cgn-l: pyqt$ python example.py
Platform : Linux-2.6.32-24-generic-i686-with-Ubuntu-10.04-lucid
Machine : i686
Qt version : 4.6.2
PyQt version : 4.7.2
Just after exec_ ...
Erreur de segmentation
I note the same behaviour on x86_64-with-Ubuntu-10.04-lucid
Regards,
Cyril.
Le 20/09/2010 11:04, Vincent Vande Vyvre a écrit :
Le 20/09/10 10:07, Cyril Giraudon a écrit :
Hello,
I am a PyQt newbye and I wanted to do some tests with QToolBar in a
QDialog (Seems multiple QMainWindow use is not recommanded in a
QApplication), so I started coding a simple example (reported below).
The code seems correct but it terminates with a segmentation fault when
the QUIT button is pressed :
"""""""""""""""""""""""""""""""""""""
(sandbox)cy...@cgn-l: pyqt$ python example.py
Qt version : 4.6.2
PyQt version : 4.7.2
Erreur de segmentation
"""""""""""""""""""""""""""""""""""""
I don't understand what happens.
Is there any explanation ?
Thanks a lot,
Cyril.
"""""""""""""""""""""""""""""""""
example.py source code
"""""""""""""""""""""""""""""""""
# -*- coding: utf8 -*-
import sys
from PyQt4.QtCore import SIGNAL, SLOT, QT_VERSION_STR, PYQT_VERSION_STR
from PyQt4.QtGui import (QApplication, QDialog, QVBoxLayout,
QToolBar, QAction, QLabel)
if __name__=='__main__':
print "Qt version : ", QT_VERSION_STR
print "PyQt version : ", PYQT_VERSION_STR
app = QApplication(sys.argv)
dialog = QDialog()
dialog.setWindowTitle(u"Bye bye")
layout = QVBoxLayout(dialog)
toolbar = QToolBar()
label = QLabel("Hello World!")
def say_bye():
label.setText("Bye Bye")
bye_action = QAction("Bye bye", dialog, triggered=say_bye)
toolbar.addAction(bye_action)
quit_action = QAction("Quit", dialog)
dialog.connect(quit_action, SIGNAL("triggered()"),
app, SLOT("quit()"));
toolbar.addAction(quit_action)
layout.addWidget(toolbar)
layout.addWidget(label)
dialog.show()
app.exec_()
"""""""""""""""""""""""""""""""""""""""""
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Salut,
Change these lines:
bye_action = QAction("Bye bye", dialog)
bye_action.triggered.connect(say_bye)
toolbar.addAction(bye_action)
quit_action = QAction("Quit", dialog)
quit_action.triggered.connect(quit)
toolbar.addAction(quit_action)
and this one:
sys.exit(app.exec_())
Cheers
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
It's strange, After the changes I do not have any more errors
I'm under Lucid 32b
vinc...@tiemoko:~/Bureau$ python bye.py
Qt version : 4.6.2
PyQt version : 4.7.2
vinc...@tiemoko:~/Bureau$
|
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt