The main window in PyQt5 is like graph it has x-axis and y-axis, all the widgets are positioned according to their x, y co-ordinates. When we create label is formed at the top left corner, the op left co-ordinates are (0, 0), we can move the label using
In this article, we will see how to get the co-ordinates of label. In order to do so we will use
x() method for x co-ordinate and
y() method for y co-ordinate.
Syntax :x_position = label.x() y_position =label.y()
Argument : Both method takes no argument.
Return : Both returns integer.
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 – 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 - Getting tool tip text of 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 – Get tooltip data of label | toolTip() method
- PyQt5 Label – Get Shadow effect object
- PyQt5 Label – Get Opacity effect object
- Python | Reverse Geocoding to get location on a map using geographic coordinates
- PyQt5 - Access the size of the Label
- How to create Label widget in PyQt5 ?
- Setting and accessing name of a Label - PyQt5
- PyQt5 – How to change text of pre-existing label | setText method
- PyQt5 – How to align Text of Label
- PyQt5 – How to auto resize Label | adjustSize QLabel
- PyQt5 – How to clear the content of label | clear and setText method
- PyQt5 – How to change font and size of Label text ?
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.