• <bdo id='pXgxi'></bdo><ul id='pXgxi'></ul>

      <i id='pXgxi'><tr id='pXgxi'><dt id='pXgxi'><q id='pXgxi'><span id='pXgxi'><b id='pXgxi'><form id='pXgxi'><ins id='pXgxi'></ins><ul id='pXgxi'></ul><sub id='pXgxi'></sub></form><legend id='pXgxi'></legend><bdo id='pXgxi'><pre id='pXgxi'><center id='pXgxi'></center></pre></bdo></b><th id='pXgxi'></th></span></q></dt></tr></i><div id='pXgxi'><tfoot id='pXgxi'></tfoot><dl id='pXgxi'><fieldset id='pXgxi'></fieldset></dl></div>
      <legend id='pXgxi'><style id='pXgxi'><dir id='pXgxi'><q id='pXgxi'></q></dir></style></legend>

      <tfoot id='pXgxi'></tfoot>

      1. <small id='pXgxi'></small><noframes id='pXgxi'>

        如何使用 Python 消除焦点或最小化窗口?

        How do I take out the focus or minimize a window with Python?(如何使用 Python 消除焦点或最小化窗口?)
          <bdo id='KEqI0'></bdo><ul id='KEqI0'></ul>

        • <small id='KEqI0'></small><noframes id='KEqI0'>

          • <tfoot id='KEqI0'></tfoot>
          • <i id='KEqI0'><tr id='KEqI0'><dt id='KEqI0'><q id='KEqI0'><span id='KEqI0'><b id='KEqI0'><form id='KEqI0'><ins id='KEqI0'></ins><ul id='KEqI0'></ul><sub id='KEqI0'></sub></form><legend id='KEqI0'></legend><bdo id='KEqI0'><pre id='KEqI0'><center id='KEqI0'></center></pre></bdo></b><th id='KEqI0'></th></span></q></dt></tr></i><div id='KEqI0'><tfoot id='KEqI0'></tfoot><dl id='KEqI0'><fieldset id='KEqI0'></fieldset></dl></div>

              <tbody id='KEqI0'></tbody>
              1. <legend id='KEqI0'><style id='KEqI0'><dir id='KEqI0'><q id='KEqI0'></q></dir></style></legend>

                  本文介绍了如何使用 Python 消除焦点或最小化窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我需要将焦点放在指定的窗口上,而我看到的唯一方法是最小化它前面的所有窗口,直到找到正确的窗口...

                  I need to get focus to a specified window, and the only way I'm seeing on my head, is minimizing all windows on front of it until I get the right one...

                  我该怎么做?

                  Windows 7,并没有特定的工具包....

                  Windows 7, and no specific toolkit....

                  每种类型的窗口,例如,firefox 和控制台命令

                  Every type of window, for example, firefox and console command

                  推荐答案

                  您需要枚举窗口并匹配窗口的标题以获得您想要的.下面的代码搜索标题中带有firefox"的窗口并设置焦点:

                  You'll need to enumerate through the windows and match the title of the window to get the one you want. The code below searches for a window with "firefox" in the title and sets the focus:

                  import win32gui
                  
                  toplist = []
                  winlist = []
                  def enum_callback(hwnd, results):
                      winlist.append((hwnd, win32gui.GetWindowText(hwnd)))
                  
                  win32gui.EnumWindows(enum_callback, toplist)
                  firefox = [(hwnd, title) for hwnd, title in winlist if 'firefox' in title.lower()]
                  # just grab the first window that matches
                  firefox = firefox[0]
                  # use the window handle to set focus
                  win32gui.SetForegroundWindow(firefox[0])
                  

                  要最小化窗口,请输入以下行:

                  To minimize the window, the following line:

                  import win32con
                  win32gui.ShowWindow(firefox[0], win32con.SW_MINIMIZE)
                  

                  这篇关于如何使用 Python 消除焦点或最小化窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Pythonic and efficient way of finding adjacent cells in grid(在网格中查找相邻单元格的 Pythonic 和有效方法)
                  map a hexagonal grid in matplotlib(在 matplotlib 中映射六边形网格)
                  Execute arbitrary python code remotely - can it be done?(远程执行任意 python 代码 - 可以吗?)
                  Python - Plotting colored grid based on values(Python - 根据值绘制彩色网格)
                  Is there a GUI design app for the Tkinter / grid geometry?(是否有 Tkinter/网格几何图形的 GUI 设计应用程序?)
                  tkinter Canvas Scrollbar with Grid?(带有网格的 tkinter 画布滚动条?)
                  <tfoot id='Vceok'></tfoot>

                1. <legend id='Vceok'><style id='Vceok'><dir id='Vceok'><q id='Vceok'></q></dir></style></legend>

                        <bdo id='Vceok'></bdo><ul id='Vceok'></ul>
                          <tbody id='Vceok'></tbody>
                      • <small id='Vceok'></small><noframes id='Vceok'>

                        <i id='Vceok'><tr id='Vceok'><dt id='Vceok'><q id='Vceok'><span id='Vceok'><b id='Vceok'><form id='Vceok'><ins id='Vceok'></ins><ul id='Vceok'></ul><sub id='Vceok'></sub></form><legend id='Vceok'></legend><bdo id='Vceok'><pre id='Vceok'><center id='Vceok'></center></pre></bdo></b><th id='Vceok'></th></span></q></dt></tr></i><div id='Vceok'><tfoot id='Vceok'></tfoot><dl id='Vceok'><fieldset id='Vceok'></fieldset></dl></div>