In this article, we will see how we can align text of labels in PyQt5 application, we can align text in three different ways which are left, right and Center.
label.setAlignment(QtCore.Qt.AlignLeft) label.setAlignment(QtCore.Qt.AlignCenter) label.setAlignment(QtCore.Qt.AlignRight)
In order to use use this we have to import
Qtcore from PyQt5
from PyQt5 import QtCore
Below is the implementation :
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- PyQt5 Scrollable Label - Getting tool tip text of the label part
- PyQt5 – How to hide label | label.setHidden method
- PyQt5 – How to change size of the Label | label.resize method
- PyQt5 Scrollable Label - Setting tool tip to the label part
- PyQt5 Scrollable Label – Setting tool tip duration to label part
- PyQt5 Scrollable Label – Getting tool tip duration of the label part
- PyQt5 Label – Checking if label is window type
- PyQt5 Label – Checking if label is widget type
- PyQt5 - How to make text center align of the editable ComboBox
- PyQt5 - How to make text center align for non-editable ComboBox
- PyQt5 – How to change text of pre-existing label | setText method
- PyQt5 – How to change font and size of Label text ?
- PyQt5 – What's this help text for Label | setWhatsThis() method
- PyQt5 - Getting text of scrollable label
- PyQt5 Scrollable Label - Retrieving tooltip text
- PyQt5 QSpinbox - Dragging text from it and dropping it to Custom Label
- How to change the Tkinter label text?
- PYGLET – Showing Text using Label
- PYGLET – Accessing Label Text
- PYGLET – Accessing Label Text Italic Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.