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.