Commit bceb1fa1 authored by Thorfin89's avatar Thorfin89

Nettoyage du code

parent 5c466ddb
64
\ No newline at end of file
60
\ No newline at end of file
......@@ -39,8 +39,9 @@ class Radio(Pupitre):
def radio_sound(self):
lecture = open("init", "r") # on charge configuration sauvegardée
self.volume_init = int(lecture.read())
self.player.audio_set_volume(self.volume_init)
volume_init = int(lecture.read())
lecture.close()
self.player.audio_set_volume(volume_init)
app = Radio() # instancie l'application
......
import tkinter as tk
root = tk.Tk()
root.geometry("600x400")
redFrame = tk.Frame(root, bg='red')
redFrame.pack_propagate(0)
redFrame.pack(fill='both', side='left', expand='True')
blueFrame = tk.Frame(root, bg='blue')
blueFrame.pack_propagate(0)
blueFrame.pack(fill='both', side='right', expand='True')
greenFrame = tk.Frame(redFrame, width=100, height=100, bg='green')
greenFrame.pack_propagate(0)
greenFrame.pack(side='top', padx=0, pady=0)
root.mainloop()
\ No newline at end of file
......@@ -3,9 +3,8 @@
# Auteur : Daniel SAZERAT (thorfin89@free.fr)
# import ----------------------------------
import os
import tkinter as tk
from tkinter import ttk, Scale, HORIZONTAL, LEFT, RIGHT, CENTER, BOTTOM, TOP
from tkinter import ttk, Scale, HORIZONTAL, LEFT, RIGHT, TOP
# classes ---------------------------------
......@@ -17,11 +16,20 @@ class Pupitre:
self.root.geometry("800x480")
self.root.resizable(width=False, height=False)
self.root.attributes('-fullscreen', False) # < A basculer sur False pour les test sur PC
# images des boutons
self.icon_play = tk.PhotoImage(file="icons/play.png")
self.icon_pause = tk.PhotoImage(file="icons/pause.png")
self.icon_stop = tk.PhotoImage(file="icons/stop.png")
self.icon_sound = tk.PhotoImage(file="icons/sound_up.png")
self.icon_mute = tk.PhotoImage(file="icons/mute.png")
self.zones()
def boucle(self):
self.root.mainloop()
# noinspection PyTypeChecker
def zones(self):
# fenêtre Haute : Titre / Menu
bandeau = tk.Frame(self.root, width="800", height="80", bg='gray')
......@@ -29,25 +37,12 @@ class Pupitre:
# fenêtre contenant les boutons (vignettes) des radios
vignettes = tk.Frame(self.root, width="500", height="400", bg='black')
vignettes.pack(side=LEFT)
vignettes.pack(side=LEFT, expand='True')
# fenêtre d'affichage de la radio en cours de lecture, et des boutons de commande
menu = tk.Frame(self.root, width="300", height="400")
menu.pack(side=RIGHT, expand='True')
# affichage de la radio en cours de lecture
"""
lbl_radio = tk.Label(bandeau, text="RADIO")
lbl_radio.pack(padx=20, pady=10)
"""
# images des boutons
self.icon_play = tk.PhotoImage(file="icons/play.png")
self.icon_pause = tk.PhotoImage(file="icons/pause.png")
self.icon_stop = tk.PhotoImage(file="icons/stop.png")
self.icon_sound = tk.PhotoImage(file="icons/sound_up.png")
self.icon_mute = tk.PhotoImage(file="icons/mute.png")
# boutons de commande
btn_play = ttk.Button(menu, image=self.icon_play, text="Play", command=self.radio_play)
btn_play.grid(row=1, column=0)
......@@ -58,10 +53,11 @@ class Pupitre:
# potentiomètre de volume
lecture = open("init", "r") # on charge configuration sauvegardée
self.volume_init = lecture.read()
volume_init = lecture.read()
lecture.close()
vol_potar = Scale(menu, from_=0, to=100, tickinterval=20, orient=HORIZONTAL, length=206, label="Volume",
command=self.volume)
vol_potar.set(self.volume_init)
vol_potar.set(volume_init)
vol_potar.grid(row=2, column=0, columnspan=3)
btn_stop = ttk.Button(menu, image=self.icon_mute, text="Mute", command=self.radio_mute)
......
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