def __init__(self, signals="pedx"): self.events = [] self.demand = Demand() self.sounds = { 'ped': html.AUDIO(src='sounds/bleeplq.mp3'), 'rag': html.AUDIO(src='sounds/trafficlq.mp3'), 'demand': html.AUDIO(src='sounds/clicklq.mp3') } self.sounds['rag'].play() self.startup() self.set_demand("off")
def __init__(self, sound, loop=True, autoplay=True, sound_type="audio/mpeg"): self.sound = html.AUDIO(src=sound, autoplay=autoplay, loop=loop, type=sound_type) document.body <= self.sound
import time from browser import document, alert, html from browser.timer import clear_interval, set_interval document <= html.AUDIO( id="audio", src="./cut_gkopeckak__bell.wav", type="audio/wav") _timer = None _alarm = None counter = 0 timer_length = 0 audio = document['audio'] pom_min = document['pom-min'] pom_sec = document['pom-sec'] break_min = document['break-min'] break_sec = document['break-sec'] start_button = document['start-btn'] stop_button = document['stop-btn'] countdown = document['countdown'] pom_button = document['pomodoro'] break_button = document['break'] def show(): global _timer, _alarm if countdown.text is '00:00': clear_interval(_timer) _timer = None calculate_countdown(timer_length) start_button.text = 'Start' stop_button.innerHTML = 'Stop ' + "🔊"