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
| from tkinter import * #importation complète du module Tkinter
def presentation():
global accueil,canvas
accueil = Tk()
accueil.title("Page d'accueil")
canvas = Canvas(accueil, bg = 'white')
canvas.pack(fill = 'both', expand = 1)
photo = PhotoImage(file="C:\\Users\\kevin\\Desktop\\brain.gif" )
canvas.create_image((accueil.winfo_screenwidth()/2),(accueil.winfo_screenheight()/2),image=photo) #je cherche à centrer l'image sur la fenêtre
l = Label(canvas, text= 'Tapez entrez pour accéder au programme').pack()
accueil.bind('<Return>', menu_de_depart)
accueil.mainloop()
def philo():
canvas.delete(ALL)
accueil.title("Philosophie")
def maths() :
canvas.delete(ALL)
accueil.title("Mathématiques")
b_qcm = Button(canvas, text = "QCM: tous les chapitres").pack()
b_calcul = Button(canvas, text = "Notre logiciel de calcul formel").pack()
def menu_de_depart(event):
""""Création de la fenêtre principale qui s'affiche après que l'utilisateur presse
la touche "Entrée" lorsque s'affiche la page d'accueil"""
global accueil,canvas
canvas.delete(ALL)
accueil.unbind('<Return>')
mess_men_prin = Label(canvas,text="Choisissez l'une des deux matières qui vous sont proposées : ",bg="white", font= ("Helvetica",12,"italic"), fg="green")
mess_men_prin.pack(side = TOP, fill = X)
b_maths = Button(canvas, text = "Mathématiques", bg = "black", fg = "white", bd = 4, relief = "groove", font = (10)).pack(side = LEFT)
b_philo = Button(canvas, text = "Philosophie", bg = "black", fg = "white", bd = 4, relief = "groove", font = (10), command= philo).pack(side = RIGHT)
presentation() |