-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
129e63a
commit ab3e35e
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from enum import Enum | ||
|
||
|
||
class FlashTimes(Enum): | ||
"""Windows flags for casement.utils.flashWindow(). | ||
https://docs.microsoft.com/en-us/windows/desktop/api/winuser/ns-winuser-flashwinfo | ||
""" | ||
|
||
"'Stop flashing. The system restores the window to its original state.'" | ||
FLASHW_STOP = 0 | ||
"Flash the window caption." | ||
FLASHW_CAPTION = 0x00000001 | ||
"Flash the taskbar button." | ||
FLASHW_TRAY = 0x00000002 | ||
"""Flash both the window caption and taskbar button. This is equivalent | ||
to setting the ``FLASHW_CAPTION | FLASHW_TRAY flags``.""" | ||
FLASHW_ALL = 0x00000003 | ||
"Flash continuously, until the ``FLASHW_STOP`` flag is set." | ||
FLASHW_TIMER = 0x00000004 | ||
"Flash continuously until the window comes to the foreground." | ||
FLASHW_TIMERNOFG = 0x0000000C |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import ctypes | ||
from .enums import FlashTimes | ||
|
||
|
||
def flash_window(hwnd, dw_flags=None, count=1, timeout=0): | ||
"""Flashes the application depending on the os. | ||
On Windows this calls FlashWindowEx. See | ||
https://msdn.microsoft.com/en-us/library/ms679348(v=vs.85).aspx for documentation. | ||
Args: | ||
hwnd (int or None): Flash this hwnd id. | ||
dw_flags (casement.enums.FlashTimes): A enum value used to control the | ||
flashing behavior. See | ||
https://msdn.microsoft.com/en-us/library/ms679348(v=vs.85).aspx for more | ||
details. Defaults to FLASHW_TIMERNOFG. | ||
count (int): The number of times to flash the window. Defaults to 1. | ||
timeout (int): The rate at which the window is to be flashed in | ||
milliseconds. if zero is passed, the default cursor blink rate is used. | ||
""" | ||
|
||
if dw_flags is None: | ||
dw_flags = FlashTimes.FLASHW_TIMERNOFG | ||
|
||
ctypes.windll.user32.FlashWindow(hwnd, int(dw_flags.value), count, timeout) |