Cannot find enumerations for QLabel
-
I have a shiny new Apple M1 Max with PyCharm CE with Python 3.8.9.
Background: I have a PyQt5 project on a Raspberry Pi, but I can't seem to find an installable version of PyQt5 for the M1, so I'm biting the bullet and using PyQt6.
I'm trying to use the 'setFrameStyle' function as in:
title = QLabel("Station") title.setFont(QFont('Arial', 40)) title.setFrameStyle(QFrame.Panel | QFrame.Raised)
The problem is that it won't run because QFrame doesn't have a property 'Panel'. All the documentation says it's supposed to be there, but I can't find it. PyCharm doesn't show it as an option, and running it generates the error.
In trying to troubleshoot I figured I'd install PyQt6 on my Raspberry, but I can't seem to get that working, either. If you have suggestions about that, I'm listening.
-
I have a shiny new Apple M1 Max with PyCharm CE with Python 3.8.9.
Background: I have a PyQt5 project on a Raspberry Pi, but I can't seem to find an installable version of PyQt5 for the M1, so I'm biting the bullet and using PyQt6.
I'm trying to use the 'setFrameStyle' function as in:
title = QLabel("Station") title.setFont(QFont('Arial', 40)) title.setFrameStyle(QFrame.Panel | QFrame.Raised)
The problem is that it won't run because QFrame doesn't have a property 'Panel'. All the documentation says it's supposed to be there, but I can't find it. PyCharm doesn't show it as an option, and running it generates the error.
In trying to troubleshoot I figured I'd install PyQt6 on my Raspberry, but I can't seem to get that working, either. If you have suggestions about that, I'm listening.
PyQt5: You say: The problem is that it won't run because QFrame doesn't have a property 'Panel', then see https://doc.qt.io/qt-5/qframe.html#Shape-enum
PyQt6: Enums are stricter so you should use:
title.setFrameStyle(QFrame.Shape.Panel | QFrame.Shape.Raised)
-
PyQt5: You say: The problem is that it won't run because QFrame doesn't have a property 'Panel', then see https://doc.qt.io/qt-5/qframe.html#Shape-enum
PyQt6: Enums are stricter so you should use:
title.setFrameStyle(QFrame.Shape.Panel | QFrame.Shape.Raised)
@eyllanesc Thank you so much! The documentation confused me when I saw
QLabel::Panel, which I read as being a direct property of QLabel and not the Shape.