<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # 等待長時間操作 GUI應用程序行為通常不穩定,您的腳本需要等待,直到出現新窗口或關閉/隱藏現有窗口。 pywinauto可以隱式地(默認超時)靈活地等待對話框初始化,或者明確地使用專用方法/函數來幫助您使代碼更容易和更可靠。 ## Application 方法 > * [wait_cpu_usage_lower](https://pywinauto.readthedocs.io/en/latest/code/pywinauto.application.html?highlight=wait_cpu_usage_lower#pywinauto.application.Application.wait_cpu_usage_lower) (new in pywinauto 0.5.2, renamed in 0.6.0) 此方法對于多線程接口很有用,當GUI響應且所有控件都已存在且似乎已準備好使用時,允許在另一個線程中進行延遲初始化。因此,等待特定窗口的存在/狀態是無用的。在這種情況下,整個進程的CPU使用率表示任務計算尚未完成。 范例: ~~~ app.wait_cpu_usage_lower(threshold=5) # 等到CPU使用率低于5% ~~~ >[info]注意:此方法僅適用于整個應用程序進程,不適用于窗口/元素。 ## WindowSpecification 方法 These methods are available to all controls. > * [wait](https://pywinauto.readthedocs.io/en/latest/code/pywinauto.application.html?highlight=wait#pywinauto.application.WindowSpecification.wait) > * [wait\_not](https://pywinauto.readthedocs.io/en/latest/code/pywinauto.application.html?highlight=wait_not#pywinauto.application.WindowSpecification.wait_not) 有一個包含長等待的例子: [install script for 7zip 9.20 x64](https://gist.github.com/vasily-v-ryabov/7a04717af4584cbb840f). `WindowSpecification`對象不一定與現有窗口/控件相關。 這只是一個描述,即搜索窗口的幾個標準。 `wait`方法(如果沒有引發任何異常)可以保證目標控件存在,甚至可見,啟用和/或激活。 ## `timings`模塊中的函數 還有一些對任何Python代碼都有用的低級方法。 > * [wait\_until](https://pywinauto.readthedocs.io/en/latest/code/pywinauto.timings.html?highlight=wait_until#pywinauto.timings.wait_until) > * [wait\_until\_passes](https://pywinauto.readthedocs.io/en/latest/code/pywinauto.timings.html?highlight=wait_until_passes#pywinauto.timings.wait_until_passes) 如果每個函數調用都應該有時序控制,也可以使用裝飾器[`pywinauto.timings.always_wait_until()`](https://pywinauto.readthedocs.io/en/latest/code/pywinauto.timings.html#pywinauto.timings.always_wait_until "pywinauto.timings.always_wait_until")和[`pywinauto.timings.always_wait_until_passes()`](https://pywinauto.readthedocs.io/en/latest/code/pywinauto.timings.html#pywinauto.timings.always_wait_until_passes "pywinauto.timings.always_wait_until_passes") ~~~ # call ensure_text_changed(ctrl) every 2 sec until it's passed or timeout (4 sec) is expired @always_wait_until_passes(4, 2) def ensure_text_changed(ctrl): if previous_text == ctrl.window_text(): raise ValueError('The ctrl text remains the same while change is expected') ~~~ ## Global timings for all actions 許多動作需要在之前,之后和之間暫停。 模塊`timings`中有幾個全局常量定義了這種暫停。 通過在對象`timings.Timings`中設置全局靜態變量,它可以單獨根據您的需要進行調整。 所有全局計時可以一次設置為默認值,或者加倍,或者除以2: ~~~ from timings import Timings Timings.defaults() Timings.slow() # double all timings (~2x slower script execution) Timings.fast() # divide all timings by two (~2x faster) ~~~ ## 識別控件 幫助您找到所需控件的方法。 > * [print_control_identifiers](https://pywinauto.readthedocs.io/en/latest/code/pywinauto.application.html?highlight=print_control_identifiers#pywinauto.application.WindowSpecification.print_control_identifiers) > * [draw_outline](https://pywinauto.readthedocs.io/en/latest/code/pywinauto.controls.hwndwrapper.html?highlight=draw_outline#pywinauto.controls.hwndwrapper.HwndWrapper.draw_outline) ### 如何 * [如何](HowTo.md)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看