You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Klausur_Test/python_template.py

49 lines
840 B

__author__ = "7509429, Gebert"
cvbnm,
#grioben Unfug
fhghjkljhvkbl
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
imported = True
try:
import simpleaudio
except ModuleNotFoundError:
imported = False
import sys, time
'''
playsound('typewriter.mp3', 0)
'''
def play_sound():
if imported:
wave_obj = simpleaudio.WaveObject.from_wave_file\
(os.path.join(dir_path, "typewriter.wav"))
play_obj = wave_obj.play()
return play_obj
return None
def stop_sound(play_obj):
if play_obj is not None:
play_obj.stop()
def print1by1(text, delay=0.1):
for c in text:
sys.stdout.write(c)
sys.stdout.flush()
time.sleep(delay)
print
play_obj = play_sound()
print1by1("Hallo, sehr geehrte Damen und Herren.")
print("\n")
stop_sound(play_obj)