[PyQt] QObject::connect with Python/C API
嶋崎一成
k.shima07 at gmail.com
Fri Sep 11 06:28:36 BST 2015
It freeze when I try to run multiple times QObject::connect with Python/C
API
I want to create a GUI using pyqt on Python with Python/C API in Qt.
I want to run python code in PyRun_SimpleString() multiple times.
has the following code
from PyQt5.QtCore import (QObject,Qt)
from PyQt5.QtWidgets import
(QMainWindow,QWidget,QPushButton,QLabel,QSlider,QHBoxLayout)
class CentralWidget(QWidget):
def __init__(self, parent=None):
super(CentralWidget, self).__init__(parent)
self.param = "test"
self.param_name_label = QLabel(self.param)
self.reset_param_value_button = QPushButton("Reset")
self.reset_param_value_button.clicked.connect(self.reset_param_value)
self.param_slider = QSlider(Qt.Horizontal)
self.param_slider.setRange(-30,30)
mlayout = QHBoxLayout(self)
mlayout.addWidget(self.param_name_label)
mlayout.addWidget(self.param_slider)
mlayout.addWidget(self.reset_param_value_button)
self.setLayout(mlayout)
def reset_param_value(self):
self.param_slider.setValue(0)
class MainWindow(QMainWindow):
def __init__(self, parent=None):
super(MainWindow,self).__init__(parent)
self.setCentralWidget(CentralWidget(self))
if __name__ == "__main__":
main_window = MainWindow()
main_window.show()
This code is to create a GUI and connect.
To freeze when I try to run this code multiple times.
This code not worked in Windows8.1.
But, Windows7 worked.
after checking
・It freeze when QObject::connect run of the second time.(row:11)
・print()..etc in Python code, And not use QtObject::connect in python
code. That is not freeze when I run multiple times.
・It not freeze when QObject::connect run of the first time.(row:11)
・If pc is Windows7, does not freeze QObject::connect run of the second time.
・If pc is Windows8.1, does freeze QObject::connect run of the second time.
・If pc is Windows8.1(compatibility mode (Windows7) and administrator), does
freeze QObject::connect run of the second time.
I want to solve this problem.
Would you please give me information.
Detailed environment of PC
Freeze : PC1,PC2
Not Freeze : PC3
PC1
===OS info===
platform : Windows-8-6.2.9200
processor : Intel64 Family 6 Model 70 Stepping 1, GenuineIntel
machine : AMD64
===Python Version info===
Qt : 5.4.1
sip : 4.16.6
PyQt : 5.4.1
Python: 3.4.2 (v3.4.2:ab2c023a9432, Oct 6 2014, 22:16:31) [MSC v.1600 64
bit (AMD64)]
PC2
===OS info===
platform : Windows-8-6.2.9200
processor : Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
machine : AMD64
===Python Version info===
Qt : 5.4.1
sip : 4.16.6
PyQt : 5.4.1
Python : 3.4.2 (v3.4.2:ab2c023a9432, Oct 6 2014, 22:16:31) [MSC v.1600 64
bit (AMD64)]
PC3
===OS info===
platform : Windows-7-6.1.7601-SP1
processor : Intel64 Family 6 Model 42 Stepping 7, GenuineIntel
machine : AMD64
===Python Version info===
Qt : 5.4.1
sip : 4.16.6
PyQt : 5.4.1
Python : 3.4.2 (v3.4.2:ab2c023a9432, Oct 6 2014, 22:16:31) [MSC v.1600 64
bit (AMD64)]
Best regards,
Thanks,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150911/626bfadd/attachment.html>
More information about the PyQt
mailing list