M
M
Mikhail Muntyan2022-02-23 16:42:36
Python
Mikhail Muntyan, 2022-02-23 16:42:36

How to maximize console window or dock it on top of windows using python?

It is necessary, under some condition in the program, to fix or focus (expand) the python console window

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2022-02-23
@limontasher

If under Windows, then you will have to use WinAPI.
GetConsoleWindow() to get a handle to the console window.
SetForegroundWindow() to make this window the active window.
SetWindowPos() is generally for moving/resizing the window, but also has parameters for setting the window "on top".
For calling WinAPI functions from python, see the ctypes module .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question