Hello, how are you?
Purpose
If you run it with that code, some windows end, but the windows end irregularly. What's the problem?
I'm a non-major, so I'd appreciate your help.
import pyautogui as GUI
win = GUI.getWindowsWithTitle("KP4") #Number of open windows: data type list
for win2 in win :
win2.activate()
GUI.hotkey("alt", "f4")
win = GUI.getWindowsWithTitle("KP4")
if len(win) == 1 :
break
```python
I haven't used pyautogui, but win = GUI.Assuming that getWindowsWithTitle("KP4")
win2.activate()
and GUI.hotkey("alt", "f4")
function normally,
import pyautogui as GUI
win = GUI.getWindowsWithTitle("KP4") #Number of open windows: data type list
for win2 in win[:-1]:
win2.activate()
GUI.hotkey("alt", "f4")
I think it would be helpful if you do it like this.
© 2024 OneMinuteCode. All rights reserved.