Is there a way to make a Python console application flash in the taskbar in Windows?
Asked Answered
N

2

14

Is there a way to make my Python console application's window flash in the Windows taskbar, to get a user's attention?

My script will be run exclusively in a relatively homogeneous Windows environment, so I don't care about detecting whether a particular API is present, or whether a solution is cross-platform or not (of course cross-platform is better for future reference... but I don't need it for this application).

Nope answered 15/7, 2010 at 18:28 Comment(0)
C
8

Flashing the taskbar in Windows is accomplished using the FlashWindowEx API function (Python API help).

I haven't tried this myself, but it should be possible to call this function from Python using PyWin32 (Python for Windows extensions) that can either by installed manually or by installing ActivePython.

Conclude answered 15/7, 2010 at 18:43 Comment(1)
This worked great for me, thanks! I know flashing the taskbar is often considered bad design, but my particular application is strictly for use at work, and my coworkers who would be using it wish to be alerted immediately when my app's finished pulling down its data.Nope
E
13

This is the simplest solution I could come up with:

import ctypes
ctypes.windll.user32.FlashWindow(ctypes.windll.kernel32.GetConsoleWindow(), True )
Eb answered 12/2, 2017 at 0:0 Comment(1)
This didn't work for me in Windows 10 1909Twotime
C
8

Flashing the taskbar in Windows is accomplished using the FlashWindowEx API function (Python API help).

I haven't tried this myself, but it should be possible to call this function from Python using PyWin32 (Python for Windows extensions) that can either by installed manually or by installing ActivePython.

Conclude answered 15/7, 2010 at 18:43 Comment(1)
This worked great for me, thanks! I know flashing the taskbar is often considered bad design, but my particular application is strictly for use at work, and my coworkers who would be using it wish to be alerted immediately when my app's finished pulling down its data.Nope

© 2022 - 2024 — McMap. All rights reserved.