Skip to content

ButtonWrapper #1316

Answered by junkmd
johnyCZS asked this question in Q&A
Jul 18, 2023 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

@johnyCZS

Hi!

We have met again.

In conclusion, the reason is that the backend is set to "win32".
To replicate a situation similar to yours, I simulated the GUI of an application in my environment as the target and ran the following steps:

>>> # Python==3.10, pywinauto==0.6.8
>>> import pywinauto
>>> from pywinauto import Desktop
>>> import pywinauto.controls
>>> # win32
>>> win32dsk = Desktop(backend="win32")
>>> btn = win32dsk.windows(title='some title')[0].children(class_name='Button')[0]
>>> isinstance(btn, pywinauto.controls.win32_controls.ButtonWrapper) 
True
>>> isinstance(btn, pywinauto.controls.uia_controls.ButtonWrapper)   
False
>>> btn.get_toggle_state
Traceback (most recent call

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@johnyCZS
Comment options

@junkmd
Comment options

@johnyCZS
Comment options

Answer selected by johnyCZS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants