PyZombis aayush/issue#218@321ced6
Social
Runestone in social media:
Follow @iRunestone
Our Facebook Page
Help support us:
Search
Table of Contents
Book Index
User
Assignments
Practice
Change Course
Instructor's Page
Progress Page
Edit Profile
Change Password
Register
Login
Dark Mode
Scratch Activecode
Help
FAQ
Instructors Guide
About Runestone
Report A Problem
3.
It looks great, now let’s add some volume!
¶
from browser import document, html def toggle_play(ev): if ev.target.checked: document['audio_player'].play() else: document['audio_player'].pause() def change_volume(ev): document['audio_player'].volume = float(ev.target.value) audio_src = 'https://bigsoundbank.com/UPLOAD/mp3/0751.mp3' audio_player = html.AUDIO(src=audio_src, id='audio_player') toggle_button = html.INPUT(type='checkbox', id='toggle_play') toggle_button.bind('change', toggle_play) toggle_label = html.LABEL('Play Sound') toggle_label <= toggle_button volume_slider = html.INPUT(type='range', id='volume', min='0', max='1', step='0.1') volume_slider.bind('input', change_volume) volume_label = html.LABEL('Volume') volume_label <= volume_slider app_div = html.DIV(id='app') app_div <= audio_player app_div <= toggle_label app_div <= volume_label document <= app_div
3.1.
Remember
¶
app.destroy()
DoubleVar()
Checkbutton()
Scale()
You have attempted
of
activities on this page