On pywinauto.rectangle() i get the position on screen of the window that I set_focus(), and on client_rect() I get the size of that window.
I want to grab the left and top of the window position on screen and the width and height of the window size.
I manage to get the width and height with a different function: w=pywinauto.win32structures.RECT.width(client_rect) h=pywinauto.win32structures.RECT.height(client_rect)
but I cant access the left and top.
app = controls.hwndwrapper.HwndWrapper(title)
rect = app.rectangle()
# print out
rect (L1293, T6, R1851, B1026)
rect type <class 'pywinauto.win32structures.RECT'>
app = controls.hwndwrapper.HwndWrapper(title)
client_rect = app.client_rect()
# print out
client_rect (L0, T0, R558, B1020)
client_rect type <class 'pywinauto.win32structures.RECT'>
# I cant access like this either:
values = []
app = controls.hwndwrapper.HwndWrapper(title)
rect = app.rect()
values.append(rect)
# print out
values [<RECT L1293, T6, R1851, B1026>]
values type <class 'list'>
# I try this too:
x = values[0]
# prints out:
x (L1293, T6, R1851, B1026)
x = values[1]
# prints out
x = values[1]
IndexError: list index out of range
There are just simple attributes of the client_rect
object:
print(client_rect.left, client_rect.top, client_rect.right, client_rect.bottom)
Also there is additional method to get central point of the rect:
print(client_rect.mid_point())
Height and width are also methods:
print(client_rect.width())
print(client_rect.height())