-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
54 lines (37 loc) · 1.4 KB
/
Copy pathmain.py
File metadata and controls
54 lines (37 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from fr.data.niv1 import Film
from tkinter import *
fenetre = Tk()
fenetre.title("Seance de Cinema - Logiciel de gestion")
fenetre.geometry("400x300")
print("Bienvenue au cinema, voici les films à l'affiche")
films = ["Gladiator", "The revenant", "The Lion king"]
for i in enumerate(films):
print(i)
f1 = Film("Gladiator", "17h30", 80)
f2 = Film("The Revenant", "14h10", 120)
f3 = Film("The Lion king", "11h00", 50)
f4 = Film("Pulp Fiction", "15h30", 80)
films = [f1, f2, f3, f4]
def click_btn(film_id,place):
print("vous avez reserver 1 place pour ", film_id)
if film_id.places > 1:
film_id.places -= 1
# print(f"vos {nbplace} places sont réservées")
print(f"il reste {film_id.places} places pour ce film ")
place.set(film_id.places)
else:
print("il ne reste plus de places")
for i in films:
print(i)
places_var = StringVar()
places_var.set(i.places)
titre_label = Label(fenetre, text=i, bg="#FFE4B5")
titre_label.grid(row=i.nb, column=0)
titre_label = Label(fenetre, textvariable=places_var, bg="#FFE4B5")
titre_label.grid(row=i.nb, column=1)
bouton = Button(fenetre, text="reserver",
command=lambda num=i, places=places_var: click_btn(num, places))
bouton.grid(row=i.nb, column=2)
# film_id = int(input("Choisir un film \n"))
# nbplace = int(input("nombre de place désirées?\n"))
fenetre.mainloop()