Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- fenetre_morpion = Tk()
- fenetre_morpion.title("Morpion ISN Nicolas C")
- #Création des boutons
- bouton_quitter = Button(fenetre_morpion, text='Quitter', command=fenetre_morpion.destroy)
- bouton_quitter.grid(row = 2, column = 1, padx=0, pady = 5, sticky=W+E ) #sticky=W+E élargit le bouton et le "colle" au bout
- # bouton_recommencer = Button(fenetre_morpion, text='Recommencer', command=reinit)
- # bouton_recommencer.grid(row = 2, column = 0, padx=0, pady=5, sticky = W+E)
- #Creation des zones de textes
- message = Label(fenetre_morpion, text='Aux croix de jouer')
- message.grid(row=0, column=0, columnspan = 2 , padx=3 , pady=3 , sticky=W+E)
- # Création d'un widget Canvas
- dessin=Canvas(fenetre_morpion, bg="white", width=301, height=301)
- dessin.grid(row = 1, column = 0, columnspan = 2, padx=5, pady=5)
- #Création des lignes
- dessin.create_line(0,100,301,100,fill="black",width=3)
- dessin.create_line(0,200,301,200,fill="black",width=3)
- dessin.create_line(100,305,301,-1000000,fill="black",width=3)
- dessin.create_line(200,305,301,-1000000,fill="black",width=3)
- # dessin.bind('<1>', morpion) #<1> représente le bouton princpal de la souris, en général le clique gauche
- def morpion_fenetre():
- dessin.delete(ALL)
- dessin.create_line(0,100,301,100,fill="black",width=3) #redessine les cases
- dessin.create_line(0,200,301,200,fill="black",width=3)
- dessin.create_line(100,305,301,-1000000,fill="black",width=3)
- dessin.create_line(200,305,301,-1000000,fill="black",width=3)
- #Sélections mini jeux
- fen =Tk()
- fen.title('Sélection des mini-jeux')
- fenetre_morpion.mainloop()
- # def lol():
- # fen_withdraw()
- # fenetre_morpion.iconify()
- SpaceInvimage=PhotoImage(file='invader.gif')
- morpionimage=PhotoImage(file='morpion_image.gif')
- dessin=Canvas(fen, bg="white", width=301, height=501)
- dessin.grid(row = 0, column = 0, columnspan = 2, padx=5, pady=5)
- bouton_minijeux = Button(fen, text='morpion', command=fen.destroy)
- bouton_minijeux.grid(row = 0, column = 0, padx=20, pady = 50, sticky=N+W)
- bouton_minijeux = Button(fen, text='spaceinvader', command=fen.destroy)
- bouton_minijeux.grid(row = 0, column = 1, padx=20, pady = 50, sticky=N+E)
- message = Label(fen, text='Sélection de mini-jeux')
- message.grid(row=0, column=0 , padx=3 , columnspan=2, pady=3, sticky=N )
- fen.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement