Commit 0d97eb9f authored by Thorfin89's avatar Thorfin89

Ajout du potentiomètre de volume

parent 8e9a2c37
...@@ -29,6 +29,11 @@ class Radio(Pupitre): ...@@ -29,6 +29,11 @@ class Radio(Pupitre):
def radio_stop(self): def radio_stop(self):
self.player.stop() self.player.stop()
def volume(self, vol):
# on récupère la valeur du potentiomètre de volume
vol_audio = int(vol)
self.player.audio_set_volume(vol_audio)
app = Radio() # instancie l'application app = Radio() # instancie l'application
app.boucle() app.boucle()
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
# import ---------------------------------- # import ----------------------------------
import tkinter as tk import tkinter as tk
from tkinter import ttk from tkinter import ttk
from tkinter import Tk, RIGHT, LEFT, SOLID, VERTICAL
from tkinter import Frame, Label, Button, messagebox, Scale
# classes --------------------------------- # classes ---------------------------------
...@@ -39,6 +41,7 @@ class Pupitre: ...@@ -39,6 +41,7 @@ class Pupitre:
# affichage de la radio en cours de lecture # affichage de la radio en cours de lecture
lbl_radio = tk.Label(bandeau, text="RADIO") lbl_radio = tk.Label(bandeau, text="RADIO")
lbl_radio.pack(padx=20, pady=10) lbl_radio.pack(padx=20, pady=10)
# boutons de commande # boutons de commande
btn_play = ttk.Button(menu, text="Play", command=self.radio_play) btn_play = ttk.Button(menu, text="Play", command=self.radio_play)
btn_play.pack() btn_play.pack()
...@@ -46,3 +49,8 @@ class Pupitre: ...@@ -46,3 +49,8 @@ class Pupitre:
btn_pause.pack() btn_pause.pack()
btn_stop = ttk.Button(menu, text="Stop", command=self.radio_stop) btn_stop = ttk.Button(menu, text="Stop", command=self.radio_stop)
btn_stop.pack() btn_stop.pack()
# potar volume
potar = Scale(menu, from_=100, to=0, orient=VERTICAL, length=200, command=self.volume)
potar.pack(padx=10, pady=5)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment