PyQTProperty Error

Phil Thompson phil at riverbankcomputing.com
Thu Mar 4 14:12:02 GMT 2021


On 04/03/2021 12:56, Ketan Dama wrote:
> Hello, any update on this?

Your original email didn't seem to make it to the mailing list.

It works fine for me with the current version.

Phil

> On Mon, 1 Mar 2021, 12:27 pm Ketan Dama, <ketandama070 at gmail.com> 
> wrote:
> 
>> Hello, Getting the error "AttributeError: 'Bug1PyQTProperty' object 
>> has no
>> attribute 'yAxis'"
>> 
>> TRACEBACK: The above exception was the direct cause of the following
>> exception:
>> 
>> Traceback (most recent call last):
>>   File "..\Bug1PyQTProperty.py", line 33, in <module>
>>     ex = Bug1PyQTProperty();
>>   File "..\Bug1PyQTProperty.py", line 20, in __init__
>>     self.ui.setupUi(self)
>>   File "D:\ui_Bug1PyQTProperty.py", line 24, in setupUi
>>     QtCore.QMetaObject.connectSlotsByName(Bug1PyQTProperty)
>> SystemError: <built-in function connectSlotsByName> returned a result 
>> with
>> an error set
>> 
>> Please note that the error is replicated only on Python 3.6 / PyQt 
>> 5.12.3
>> / Qt 5.12.3 Windows 7 & 10,
>> while the script is working on Python 3.4 / PyQt 5.7.1 / Qt 5.4 / 
>> Windows
>> 7 & 10
>> 
>> Kindly let me know why the script works in the version of PyQT while 
>> it
>> fails in another version?
>> 
>> 
>> Script: Bug1PyQTProperty.py:
>> 
>> import sys
>> sys.dont_write_bytecode = True
>> 
>> from PyQt5 import QtCore, QtGui, QtWidgets
>> from PyQt5.QtCore import (pyqtProperty, pyqtSignal, pyqtSlot)
>> 
>> 
>> from ui_Bug1PyQTProperty import Ui_Bug1PyQTProperty
>> 
>> class Bug1PyQTProperty(QtWidgets.QWidget):
>> def __init__(self, parent=None):
>> super(Bug1PyQTProperty, self).__init__(parent)
>> self.ui=Ui_Bug1PyQTProperty()
>> self.ui.setupUi(self)
>> self._yAxis=0
>> 
>> @pyqtProperty(bool)
>> def yAxis(self):
>> return self._yAxis
>> 
>> @yAxis.setter
>> def yAxis(self,arg):
>> self._yAxis=arg
>> 
>> if __name__ == '__main__':
>> app = QtWidgets.QApplication(sys.argv);
>> ex = Bug1PyQTProperty();
>> ex.show();
>> sys.exit(app.exec_())
>> 
>> 
>> Script: ui_Bug1PyQTProperty.py
>> 
>> from PyQt5 import QtCore, QtGui, QtWidgets
>> 
>> class Ui_Bug1PyQTProperty(object):
>>     def setupUi(self, Bug1PyQTProperty):
>>         Bug1PyQTProperty.setObjectName("Bug1PyQTProperty")
>>         Bug1PyQTProperty.resize(400, 300)
>>         Bug1PyQTProperty.setStyleSheet("background-color: rgb(255, 
>> 255,
>> 0);")
>>         self.pushbutton = QPushButton(Bug1PyQTProperty)
>>         self.pushbutton.setGeometry(QtCore.QRect(150, 70, 32, 23))
>>         self.pushbutton.setStyleSheet("background-color: rgb(255, 0,
>> 127);")
>>         self.pushbutton.setObjectName("pushbutton")
>> 
>>         self.retranslateUi(Bug1PyQTProperty)
>>         QtCore.QMetaObject.connectSlotsByName(Bug1PyQTProperty)
>> 
>>     def retranslateUi(self, Bug1PyQTProperty):
>>         _translate = QtCore.QCoreApplication.translate
>>         Bug1PyQTProperty.setWindowTitle(_translate("Bug1PyQTProperty",
>> "Screen"))
>> 
>> Script: Bug1PyQTProperty.ui
>> 
>> <?xml version="1.0" encoding="UTF-8"?>
>> <ui version="4.0">
>>  <class>Bug1PyQTProperty</class>
>>  <widget class="QWidget" name="Bug1PyQTProperty">
>>   <property name="geometry">
>>    <rect>
>>     <x>0</x>
>>     <y>0</y>
>>     <width>400</width>
>>     <height>300</height>
>>    </rect>
>>   </property>
>>   <property name="windowTitle">
>>    <string>Screen</string>
>>   </property>
>>   <property name="styleSheet">
>>    <string notr="true">background-color: rgb(255, 255, 0);</string>
>>   </property>
>>   <widget class="QPushButton" name="pushbutton">
>>    <property name="geometry">
>>     <rect>
>>      <x>150</x>
>>      <y>70</y>
>>      <width>32</width>
>>      <height>23</height>
>>     </rect>
>>    </property>
>>    <property name="styleSheet">
>>     <string notr="true">background-color: rgb(255, 0, 127);</string>
>>    </property>
>>   </widget>
>>  </widget>
>> 
>>  <resources/>
>>  <connections/>
>> </ui>
>> 


More information about the PyQt mailing list