【问题标题】:How to select icons in windows application using Pywinauto如何使用 Pywinauto 在 Windows 应用程序中选择图标
【发布时间】:2012-04-17 18:10:10
【问题描述】:

我正在尝试模拟单击 Windows 应用程序上的图标。 目前,我这样做的唯一方法是使用 ClickInput(coords = (x,y)) 模拟鼠标点击 上述方法的问题是,每当软件 UI 更新时,它的位置就会发生变化,这迫使我根据新的图标位置更新所有脚本。

有没有办法在不使用坐标的情况下模拟工具条中的图标点击?

【问题讨论】:

    标签: click icons simulate pywinauto


    【解决方案1】:

    是的!据我所知,pywinauto 中的图像看起来像 Static

    Access names : ['Static4']
    Class : Static
    ClientRects : [<RECT L0, T0, R24, B24>]
    ContextHelpID : 0
    ControlCount : 0
    ControlID : 269
    ExStyle : 4
    Fonts : [<LOGFONTW 'MS Shell Dlg' -11>]
    FriendlyClassName : Static
    handle : 2097378
    Image : <Image._ImageCrop image mode=RGB size=24x24 at 0x1E47DC8>
    IsEnabled : True
    IsUnicode : True
    IsVisible : True
    MenuItems : []
    pwa_type : <class 'pywinauto.controls.win32_controls.StaticWrapper'>
    Rectangle : (L514, T498, R538, B522)
    Style : 1342179331
    Texts : ['']
    UserData : 0
    

    您可以轻松访问它

    window['Static4'].Click()
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-10
      • 1970-01-01
      • 2018-11-27
      • 2022-11-02
      • 1970-01-01
      • 2013-03-28
      • 2022-07-09
      • 2020-01-21
      相关资源
      最近更新 更多