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
| # coding: utf-8
from tkinter import*
from Manip_chaines import*
def un ():
mot=saisie.get()
label_reponse.configure(text=question1(mot))
#créer la fenêtre principale
f1=Tk()
f1.title("Mon projet tkinter")#change le titre la fenêtre
f1.iconbitmap("logo.ico")#change le logo de la fenêtre
f1.config(bg='#191919')
f1.attributes('-fullscreen', 1)#met la fenêtre en plein écran
frame1=Frame (f1, bg='#191919', relief='sunken', bd=2)#crée une boite indépendante pour le titre
frame1.pack(fill=X)
frame3=Frame (f1, bg='#191919', relief='sunken', bd=2)#crée une troisième boite pour la saisie et la réponse
frame3.pack(fill=X, pady=17)
frame2=Frame (f1, bg='#191919', relief='sunken', bd=2)#cré une seconde boite indépendante pour les boutons
frame2.pack(fill=X)
etqt1= Label (frame1, text="Que voulez-vous faire ?", font=("Uni Sans", 50), bg='#191919', fg='#ffffff').pack(pady=10)
etqt2= Label (frame1, text="Bienvenue ! Entre ton mot à gauche, choisis une option et découvre le résultat à droite !", font=('Uni Sans', 20), bg='#191919', fg='white').pack()#créer l'étiquettre "que voulez-vous faire?"
saisie=Entry (frame3, bg='white', font=("Courrier",20), width=35, fg='black').grid(row=0, column=0, padx=50)
label_reponse=Label (frame3, text="Réponse", bg='white', font=("Courrier",20), width=35, fg='black').grid(row=0, column=1, padx=260)
fo=("Courrier", 30)
bg="#7289da"
abckd="#03396c"
actfd="white"
fg="white"
bd=0
width=15
height=5
#crée les boites de droite à gauche et de haut en bas
B1=Button (frame2, text="Met votre mot \n à l'envers", font=fo, bg=bg, activebackground=abckd, activeforeground=actfd, fg=fg, bd=bd, width=width, height=height, command=un).grid(row=0, column=0, padx=10, pady=20)
B2=Button (frame2, text="Met une étoile \n entre chaque lettre", font=fo, bg=bg, activebackground=abckd, activeforeground=actfd, fg=fg, bd=bd, width=width, height=height).grid(row=0, column=1, padx=20, pady=20)
B3=Button (frame2, text="Met une étoile \n entre chaque lettre \n sauf espace", font=fo, bg=bg, activebackground=abckd, activeforeground=actfd, fg=fg, bd=bd, width=width, height=height).grid(row=0, column=2, padx=20, pady=20)
B4=Button (frame2, text="Affiche autant \n d'étoiles \n que de lettres \n dans le mot", font=fo, bg=bg, activebackground=abckd, activeforeground=actfd, fg=fg, bd=bd, width=width, height=height).grid(row=0, column=3, padx=20, pady=20)
B5=Button (frame2, text="Affiche 1 fois \n la 1ere lettre\n 2 fois la 2eme, etc", font=fo, bg=bg, activebackground=abckd, activeforeground=actfd, fg=fg, bd=bd, width=width, height=height).grid(row=1, column=0, padx=10, pady=20)
B6=Button (frame2, text="Affiche le mot \n sans les voyelles", font=fo, bg=bg, activebackground=abckd, activeforeground=actfd, fg=fg, bd=bd, width=width, height=height).grid(row=1, column=1, padx=20, pady=20)
B7=Button (frame2, text="Met les consonnes \n au début et \n les voyelles à la fin", font=fo, bg=bg, activebackground=abckd, activeforeground=actfd, fg=fg, bd=bd, width=width, height=height).grid(row=1, column=2, padx=20, pady=20)
B8=Button (frame2, text="Calcule le nombre \n de points au \n scrabble \n pour le mot", font=fo, bg=bg, activebackground=abckd, activeforeground=actfd, fg=fg, bd=bd, width=width, height=height).grid(row=1, column=3, padx=20, pady=20)
Button(frame2, text="Quitter",font=20, command=f1.destroy, bg='red', fg='white',bd=1, relief=GROOVE, width=7, height=1).grid(row=2, column=3)#bouton quitter car difficile en plein écran
f1.mainloop() |
Partager