Commit 9bb9bb12 authored by Thorfin89's avatar Thorfin89

Placement des logos des radios OK

parent cb784c24
......@@ -37,3 +37,6 @@ def radios_display(self): # récupération de la liste des radios (+infos)
#### Doc tkinter :
- http://tkinter.fdex.eu/index.html
- http://pascal.ortiz.free.fr/contents/tkinter/tkinter/
#### streams radios
- https://github.com/riencroonenborghs/streaming_radio/blob/master/assets/data/stations.json
......@@ -2,15 +2,15 @@ No,Pays,Type,Nom,Url,Logo
1,France,Régionale,France Bleue Auxerre,http://direct.francebleu.fr/live/fbauxerre-midfi.mp3,fb-auxerre.png
2,France,Régionale,France Bleue Isère,http://direct.francebleu.fr/live/fbisere-midfi.mp3,fb-isere.png
3,France,Régionale,France Bleu Armorique,http://direct.francebleu.fr/live/fbarmorique-midfi.mp3,fb-armorique.png
4,France,Informations,France Info,http://direct.franceinfo.fr/live/franceinfo-midfi.mp3,france-info.jpeg
4,France,Informations,France Info,http://direct.franceinfo.fr/live/franceinfo-midfi.mp3,france-info.png
5,France,Généraliste,France Inter,http://direct.franceinter.fr/live/franceinter-midfi.mp3,france-inter.png
6,France,Généraliste,Europe 1,http://mp3lg4.tdf-cdn.com/9240/lag_180945.mp3,europe-1.jpeg
7,UK,Rock,Dépèche Mode,http://streaming.radionomy.com/wwwdepechemodebe-radio,radio.png
6,France,Généraliste,Europe 1,http://mp3lg4.tdf-cdn.com/9240/lag_180945.mp3,europe-1.png
7,UK,Rock,Dépèche Mode,http://streaming.radionomy.com/wwwdepechemodebe-radio,
8,DE,Celtic,Live Ireland ch1,http://66.90.73.250:8080,live-ireland.png
9,DE,Celtic,Bretagne Blog,http://laut.fm/bretagneblog,radio.png
10,DE,Celtic,Highlander Radio Live Stream,http://50.7.71.27:9657,radio.png
11,DE,Celtic,Celtic Moon,http://streaming211.radionomy.com:80/CelticMoon,radio.png
9,DE,Celtic,Bretagne Blog,http://laut.fm/bretagneblog,bretagneblog.png
10,DE,Celtic,Highlander Radio Live Stream,http://50.7.71.27:9657,Highlander.png
11,DE,Celtic,Celtic Moon,http://streaming211.radionomy.com:80/CelticMoon,
12,DE,Celtic-punk,Celtic-Folk-Punk,http://streaming211.radionomy.com:80/Celtic-Folk-Punk,
13,DE,Hard-rock,100% Hardrock,http://streaming207.radionomy.com:80/100-HARD-ROCK,
14,DE,Rock,Virgin Rock 70,http://icy.unitedradio.it/VirginRock70.mp3,radio.png
15,FR,Classic,Frane Musique,http://direct.francemusique.fr/live/francemusique-midfi.mp3,
\ No newline at end of file
14,DE,Rock,Virgin Rock 70,http://icy.unitedradio.it/VirginRock70.mp3,virginrock70.png
15,FR,Classic,France Musique,http://direct.francemusique.fr/live/francemusique-midfi.mp3,france-musique.png
\ No newline at end of file
images/fb-armorique.png

4.55 KB | W: | H:

images/fb-armorique.png

16.4 KB | W: | H:

images/fb-armorique.png
images/fb-armorique.png
images/fb-armorique.png
images/fb-armorique.png
  • 2-up
  • Swipe
  • Onion skin
images/fb-auxerre.png

4.42 KB | W: | H:

images/fb-auxerre.png

15.8 KB | W: | H:

images/fb-auxerre.png
images/fb-auxerre.png
images/fb-auxerre.png
images/fb-auxerre.png
  • 2-up
  • Swipe
  • Onion skin
images/fb-isere.png

3.97 KB | W: | H:

images/fb-isere.png

15.3 KB | W: | H:

images/fb-isere.png
images/fb-isere.png
images/fb-isere.png
images/fb-isere.png
  • 2-up
  • Swipe
  • Onion skin
images/france-inter.png

2.65 KB | W: | H:

images/france-inter.png

14.7 KB | W: | H:

images/france-inter.png
images/france-inter.png
images/france-inter.png
images/france-inter.png
  • 2-up
  • Swipe
  • Onion skin
images/jazz-radio.png

12.2 KB | W: | H:

images/jazz-radio.png

22.6 KB | W: | H:

images/jazz-radio.png
images/jazz-radio.png
images/jazz-radio.png
images/jazz-radio.png
  • 2-up
  • Swipe
  • Onion skin
images/live-ireland.png

9.95 KB | W: | H:

images/live-ireland.png

13.6 KB | W: | H:

images/live-ireland.png
images/live-ireland.png
images/live-ireland.png
images/live-ireland.png
  • 2-up
  • Swipe
  • Onion skin
images/rtl.png

1.37 KB | W: | H:

images/rtl.png

9.95 KB | W: | H:

images/rtl.png
images/rtl.png
images/rtl.png
images/rtl.png
  • 2-up
  • Swipe
  • Onion skin
images/tsf-jazz.png

6.36 KB | W: | H:

images/tsf-jazz.png

14.2 KB | W: | H:

images/tsf-jazz.png
images/tsf-jazz.png
images/tsf-jazz.png
images/tsf-jazz.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -47,7 +47,12 @@ class Radio(Pupitre):
config_file.close()
self.player.audio_set_volume(volume_init)
'''
def radios_display(self): # récupération de la liste des radios (+infos)
logos = [["", "", "", "", ""],
["", "", "", "", ""],
["", "", "", "", ""],
["", "", "", "", ""]]
with open("./data/radios.csv", 'r', encoding='utf8') as radios_file:
radios_list = csv.DictReader(radios_file)
radios_list = [dict(ligne) for ligne in radios_list] # transforme en liste de dictionnaires
......@@ -56,6 +61,7 @@ class Radio(Pupitre):
print(radios_list[3]['Nom']) # extrait le nom de la 4ème radio
for c in range(nb_radios): # affiche la liste des 14 radios
print(radios_list[c]['No'], ":", radios_list[c]['Nom'])
'''
app = Radio() # instancie l'application
app.boucle()
......@@ -5,6 +5,7 @@
# import ----------------------------------
import tkinter as tk
from tkinter import ttk, Scale, HORIZONTAL, CENTER, LEFT, RIGHT, TOP
import csv
mute = False # le son n'est pas coupé au démarrage
......@@ -28,9 +29,10 @@ class Pupitre:
self.icon_sound = tk.PhotoImage(file="icons/sound_up.png")
self.icon_mute = tk.PhotoImage(file="icons/mute.png")
self.logo = tk.PhotoImage(file="images/radio.png")
self.logox = tk.PhotoImage(file="images/radio.png")
self.zones()
self.radios_display()
# noinspection PyTypeChecker
def zones(self):
......@@ -39,8 +41,8 @@ class Pupitre:
bandeau.pack(side=TOP, expand='True')
# fenêtre contenant les boutons (logos) des radios > dim 500x400
zone_logos = tk.Frame(self.root, width="500", height="400", bg='black')
zone_logos.pack(side=LEFT, expand='True')
self.zone_logos = tk.Frame(self.root, width="500", height="400", bg='black')
self.zone_logos.pack(side=LEFT, expand='True')
# fenêtre d'affichage de la radio en cours de lecture, et des boutons de commande > dim 300x400
menu = tk.Frame(self.root, width="300", height="400", bg="#D9D9D9")
......@@ -86,15 +88,28 @@ class Pupitre:
lbl_info = ttk.Label(menu, text="WebRadioPi © Thorfin89", anchor=CENTER)
lbl_info.place(width=300, height=16, x=x_menu + 0, y=y_menu + 140)
# affichage des vignettes des radios
for x_logos in range(5):
for y_logos in range(4):
btn_logo = tk.Button(zone_logos, image=self.logo, command=self.switch_sound)
btn_logo.place(width=100, height=100, x=x_logos*100, y=y_logos*100)
def radios_display(self): # récupération de la liste des radios (+infos)
self.logo = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]
with open("./data/radios.csv", 'r', encoding='utf8') as radios_file:
radios_list = csv.DictReader(radios_file)
radios_list = [dict(ligne) for ligne in radios_list] # transforme en liste de dictionnaires
c = 0
d = 0
for y in range(4):
for x in range(5):
try:
if radios_list[c]['Logo'] != "":
self.logo[c] = tk.PhotoImage(file="images/" + radios_list[c]['Logo'])
else:
self.logo[c] = tk.PhotoImage(file="images/radio.png")
except:
self.logo[c] = tk.PhotoImage(file="images/blank.png")
btn_logo = tk.Button(self.zone_logos, image=self.logo[c], command=None)
btn_logo.place(width=100, height=100, x=x * 100, y=y * 100)
print(str(x)+":"+str(y) + " - " + str(c))
c += 1
def switch_sound(self):
# bascule on/off du son
......@@ -110,5 +125,4 @@ class Pupitre:
mute = False
def boucle(self):
self.radios_display()
self.root.mainloop()
74
\ No newline at end of file
71
\ No newline at end of file
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