Checking a checkbox with pywinauto does not work

I installed the latest pywinauto module from pip.
I do not know how to use the Check (), UnCheck (), GetCheckState () methods.

This is my very simple code example.

from pywinauto import application

# Start the madvr settings application.
app = application.Application()
app.start_(r'C:\Program Files\LAV Filters\x86\madVR\madHcCtrl.exe editLocalSettingsDontWait')

# Handle the madvr settings window.
madvr = app.window_(title_re="madVR.*")

# Enable the smooth motion tab.
madvr.TreeView.GetItem(r'\rendering\smooth motion').Click()

# Check the smooth motion checkbox.
madvr.TCheckBox.Check()

It works if I use the Click () method, but that is not what I want.

madvr.TCheckBox.Click()

If the check box is already checked, it cancels it.

Why can't I use the Check () method?
I tried using the Uncheck () and GetCheckState () methods, they did not work either.

+4
source share
2 answers

"TCheckBox" "TCheckBox" 0.5.1 ( ). . ( pywinauto == 0.6.x):

from pywinauto.controls.win32_controls import ButtonWrapper
checkbox = ButtonWrapper(madvr.TCheckBox.wrapper_object())
checkbox.get_check_state()
+3

:

get_toggle_state()

checkbox = ButtonWrapper(madvr.TCheckBox.wrapper_object())
checkbox.get_toggle_state()
0

All Articles