I am trying to automate the Cambium LINKPlanner application using pywinauto, and found controls for almost everything I needed. However, there is a checked list box which has the identifier 'ListBox' and there doesn't seem to be any way to check/uncheck the items in the list.
I can list the contents of the ListBox:
>>> app.LINKPlanner.ListBox.item_texts()
['PMP 450b High Gain', 'PMP 450b Mid-gain', 'PMP450 (retired)', 'PMP450d (retired)', 'PMP450i', 'PMP450i ATEX/HAZLOC']
I can highlight an item in the ListBox either by name or position:
>>> app.LINKPlanner.ListBox.select('PMP450i')
<win32_control.ListBoxWrapper - '', ListBox, 70154>
>>> app.LINKPlanner.ListBox.select(2)
<win32_control.ListBoxWrapper - '', ListBox, 70154>
But I can't check/uncheck the checkbox inside the list items.
Any suggestions?
EDIT:
Using Vasily's suggestion, I was able to see the bounding box, then use click_input to click the checkbox.
>>> app.LINKPlanner.ListBox.select('PMP 450b High Gain').item_rect(0)
<RECT L0, T0, R276, B17>
>>> app.LINKPlanner.ListBox.select('PMP 450b High Gain').click_input(coords=(9,9))
If it's detected as ListBox, it may be owner-drawn check boxes which can't be detected separately. I'd suggest using method .item_rect(item_name)
and then method .click_input()
. Also method .client_to_screen()
may be helpful.