Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions 30 day challenge/Day 30 - Conclusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#
# Styles - normal, bold, roman, italic, underline, and overstrike.

v=DoubleVar() # For getting the current volume

statusbar = ttk.Label(root, text="Welcome to Melody", relief=SUNKEN, anchor=W, font='Times 10 italic')
statusbar.pack(side=BOTTOM, fill=X)

Expand Down Expand Up @@ -201,12 +203,15 @@ def set_vol(val):

def mute_music():
global muted
global cv # have current volume
if muted: # Unmute the music
mixer.music.set_volume(0.7)
y = cv/ 100
mixer.music.set_volume(y)
volumeBtn.configure(image=volumePhoto)
scale.set(70)
scale.set(cv)
muted = FALSE
else: # mute the music
cv = v.get() # taking current volume before muting
mixer.music.set_volume(0)
volumeBtn.configure(image=mutePhoto)
scale.set(0)
Expand Down Expand Up @@ -242,7 +247,7 @@ def mute_music():
volumeBtn = ttk.Button(bottomframe, image=volumePhoto, command=mute_music)
volumeBtn.grid(row=0, column=1)

scale = ttk.Scale(bottomframe, from_=0, to=100, orient=HORIZONTAL, command=set_vol)
scale = ttk.Scale(bottomframe, from_=0, to=100,variable=v,orient=HORIZONTAL, command=set_vol)
scale.set(70) # implement the default value of scale when music player starts
mixer.music.set_volume(0.7)
scale.grid(row=0, column=2, pady=15, padx=30)
Expand Down