From b0aa7b0218479f0d5c22b247be77d17f3fd36737 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Tue, 16 Jul 2019 17:53:20 -0600 Subject: [PATCH] Added beep() --- scripts/wk/std.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/wk/std.py b/scripts/wk/std.py index 37949af6..174c4e92 100644 --- a/scripts/wk/std.py +++ b/scripts/wk/std.py @@ -48,6 +48,16 @@ def ask(prompt='Kotaero!'): return answer +def beep(repeat=1): + """Play system bell with optional repeat.""" + # TODO: Verify Windows functionality + while repeat >= 1: + # Print bell char without a newline + print('\a', end='', flush=True) + sleep(0.5) + repeat -= 1 + + def clear_screen(): """Simple wrapper for clear/cls.""" if os.name == 'nt':