How can I rotate a QLabel in PyQt5?
-
I have a question! How can I rotate a QLabel in PyQt5?
I already did it with.setStyleSheet('transform: rotate(90deg)')
but that did nothing!
-
@niklaspeter123
You are being optimistic thinking QSS will accept that CSS --- it won't!.See e.g. https://stackoverflow.com/questions/19489999/qlabel-rotation. I believe you can rotate its pixmap but not its text.
-
But
- It's C++ and not Python!
- How can i put a label into a QPixmap?
Nevertheless many thanks!
-
@niklaspeter123
Most examples for Qt are in C++. If you can find a Python example that's fine. Otherwise you have to translate from C++ to Python, which I don't think is very hard.You cannot put a
QLabel
onto aQPixmap
. You can put aQPixmap
onto aQLabel
. -
How? If it wasn't so difficult to translate from C++ to Python?
-
@niklaspeter123
Sorry, "How" what? -
Hi,
Load your picture in a QImage, rotate it and the make a QPixmap out of it before setting it on your QLabel.