K
K
kgaudium2020-08-24 08:03:05
Python
kgaudium, 2020-08-24 08:03:05

PyQt5 AttributeError: 'BindChanger' object has no attribute 'RadarKey'?

I created a design in Designer, converted it to a .py file, but there were problems creating an executable file. When I access KeySequenceEdit I get an error AttributeError: 'BindChanger' object has no attribute 'RadarKey' . I copied the name of the object from the designer and in the ui file itself there is a line self.RadarKey = QtWidgets.QKeySequenceEdit(self.centralwidget) .
The code:

from PyQt5.QtWidgets import QMainWindow, QApplication
import design
import sys, os

class BindChanger(QMainWindow, design.Ui_BindChanger):
    def __init__(self):
        super().__init__()
        self.ui = design.Ui_BindChanger()
        self.ui.setupUi(self)
        self.RadarKey.keySequenceChanged.connect(RadarButton)

app = QApplication(sys.argv)
window = BindChanger()
window.show() 
app.exec()

By the way, how to pull the KeySequence value into a variable?

Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kgaudium, 2020-08-24
@kgaudium

Corrected the error: it was necessary instead

self.RadarKey.keySequenceChanged.connect(RadarButton)

write
self.ui.RadarKey.keySequenceChanged.connect(RadarButton)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question