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
| # -*- coding: utf-8 -*-
# Python 2
from Tkinter import *
scenario_texte = [
'Bonjour',
'mon premier scénario !',
'Au revoir',
]
num_scenario = 0
def intro():
global msg, BoutonLancer, BoutonContinuer
BoutonLancer.forget()
BoutonContinuer = Button(Mafenetre, text='Go', command=suivant)
BoutonContinuer.pack(side = BOTTOM, padx = 380, pady = 5)
msg.pack(side = BOTTOM)
def suivant():
global msg, num_scenario, BoutonContinuer
msg.config(text=scenario_texte[num_scenario])
num_scenario += 1
if (num_scenario >= len(scenario_texte)): # La dernière planche est passée
BoutonContinuer.config(text='Quitter')
BoutonContinuer.config(command=Mafenetre.destroy) # Ferme la fenêtre
Mafenetre = Tk()
Mafenetre.title('Survival Z')
Mafenetre.geometry('800x600') # création de la fenetre
BoutonLancer = Button(Mafenetre, text ='Jouer', command=intro, image="")
BoutonLancer.pack(side = RIGHT, padx = 380, pady = 5) # création du bouton jouer
msg = Label(Mafenetre, text='Bienvenue en Enfer')
msg.config(font=('courier', 20, 'bold'))
msg.config(bg='black', fg='red')
msg.config(height=800, width=600)
Mafenetre.mainloop() |
Partager