I am trying to return the output of all windows locations based on names, which I have done.
However for some reason I can't get the results returned as 1 line, a list of tuples etc. I am getting the output returned in separate lines (which I then can't use as a whole).
Code:
import win32gui as win
win_name = "SomeApplication"
def get_all_windows_locs(hwnd, lparam):
if win_name in win.GetWindowText(hwnd):
windows_locs = win.GetWindowRect(hwnd)
print(windows_locs)
win.EnumWindows(get_all_windows_locs, None)
Output:
(2, 2, 1162, 803)
(768, 1112, 1928, 1913)
(1421, 635, 2581, 1436)
I really want to have this returned as an actual list of tuples. Something along the lines of this:
(2, 2, 1162, 803), (768, 1112, 1928, 1913), (1421, 635, 2581, 1436)
The reason I want it returned in 1 line is that if I call it outside the function it only returns the last line from the output.