#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Apr 14 11:39:29 2020 @author: Augustin """ from tkinter import * class Application(Tk): def __init__(self): Tk.__init__(self) self.frame = None self.switch_frame(Page1) self.title("EPF DE TOI")# self.geometry("600x500") self.config(background='#FCCFFC') def switch_frame(self, frame_class): new_frame = frame_class(self) if self.frame is not None: self.frame.destroy() self.frame = new_frame self.frame.pack(expand=YES) class Page1(Frame): def __init__(self, master): Frame.__init__(self, master, bg='#FCCFFC') Label(self, text="Bienvenue sur EPF DE TOI!!", font=("Courrier", 40), bg='#FCCFFC', fg='white').pack(expand=YES) Button(self, text="JOUER", font=("Courrier", 35), bg='white', fg='#FCCFFC', relief=RAISED, command=lambda: master.switch_frame(Page2)).pack(pady=20, fill=X) class Page2(Frame): def __init__(self, master): Frame.__init__(self, master, bg='#FCCFFC') Label(self, text="Choisi le sexe de ton personnage:", font=('Courrier', 30), bg='#FCCFFC', fg='white').pack(expand=YES, side="top", fill="x", pady=5) self.bouton_homme=Button(self, text="Les Hommes", font=("Courrier", 35), bg='white', fg='#FCCFFC', command=lambda:master.switch_frame(Page3)) self.bouton_homme.pack(pady=20, fill=X) self.bouton_femme=Button(self, text="Les Femmes", font=("Courrier", 35), bg='white', fg='#FCCFFC', command=lambda:master.switch_frame(Page3)) self.bouton_femme.pack(pady=20, fill=X) self.bouton_les2=Button(self, text="Les Hommes et les Femmes", font=("Courrier", 35), bg='white', fg='#FCCFFC', command=lambda:master.switch_frame(Page3)) self.bouton_les2.pack(pady=20, fill=X) class Page3(Frame): def __init__(self, master): Frame.__init__(self, master) Frame.configure(self, bg='#FCCFFC') self.affichage_personnages() # self.bouton_homme def affichage_personnages(self): if self.bouton_homme.clic==TRUE: self.photo_maxime= PhotoImage(file="Maxime.gif") self.zone_maxime=Canvas(self, width=200, height=300) self.zone_maxime.create_image(0,0, photo_maxime) self.zone_maxime.pack() # if bouton_femme.clic==TRUE: # # if bouton_les2.clic==TRUE: # # app = Application() app.mainloop()