Answers for "move window by name"

0

move window by name

import win32gui
import tkinter as tk
from tkinter import simpledialog

ROOT = tk.Tk()

ROOT.withdraw()
# the input dialog
USER_INP = simpledialog.askstring(title="Test",
                                  prompt="window name?:")


def enumHandler(hwnd, lpara):
    if win32gui.IsWindowVisible(hwnd):
        if USER_INP in win32gui.GetWindowText(hwnd):
            win32gui.MoveWindow(hwnd, 0, 0, 1280, 750, True)


win32gui.EnumWindows(enumHandler, None)
Posted by: Guest on September-22-2021

Python Answers by Framework

Browse Popular Code Answers by Language