Advertisement
horozov86

Volume

Jul 9th, 2024
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. volume_slider = ttk.Scale(wnd, from_=0, to=1, orient=HORIZONTAL, value=1, length=150, command=set_volume)
  2. volume_slider.pack(side=RIGHT, pady=20, padx=10)
  3.  
  4.  
  5. def set_volume(val):
  6.     pygame.mixer.music.set_volume(volume_slider.get())
  7.  
  8.  
  9. # to get the current volume
  10. current_volume = pygame.mixer.music.get_volume()
  11. time_field.config(text=current_volume)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement