Advertisement
Guest User

Untitled

a guest
Apr 7th, 2020
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.34 KB | None | 0 0
  1. from tkinter import *
  2. fenetre_morpion = Tk()
  3. fenetre_morpion.title("Morpion ISN Nicolas C")
  4.  
  5. #Création des boutons
  6. bouton_quitter = Button(fenetre_morpion, text='Quitter', command=fenetre_morpion.destroy)
  7. 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
  8.  
  9. # bouton_recommencer = Button(fenetre_morpion, text='Recommencer', command=reinit)
  10. # bouton_recommencer.grid(row = 2, column = 0, padx=0, pady=5, sticky = W+E)
  11.  
  12. #Creation des zones de textes
  13. message = Label(fenetre_morpion, text='Aux croix de jouer')
  14. message.grid(row=0, column=0,  columnspan = 2  , padx=3 , pady=3 , sticky=W+E)
  15.  
  16. # Création d'un widget Canvas
  17. dessin=Canvas(fenetre_morpion, bg="white", width=301, height=301)
  18. dessin.grid(row = 1, column = 0, columnspan = 2, padx=5, pady=5)
  19.  
  20. #Création des lignes
  21. dessin.create_line(0,100,301,100,fill="black",width=3)
  22. dessin.create_line(0,200,301,200,fill="black",width=3)
  23. dessin.create_line(100,305,301,-1000000,fill="black",width=3)
  24. dessin.create_line(200,305,301,-1000000,fill="black",width=3)
  25.  
  26. # dessin.bind('<1>', morpion) #<1> représente le bouton princpal de la souris, en général le clique gauche
  27.  
  28. def morpion_fenetre():
  29.   dessin.delete(ALL)
  30.   dessin.create_line(0,100,301,100,fill="black",width=3) #redessine les cases
  31.   dessin.create_line(0,200,301,200,fill="black",width=3)
  32.   dessin.create_line(100,305,301,-1000000,fill="black",width=3)
  33.   dessin.create_line(200,305,301,-1000000,fill="black",width=3)
  34.  
  35.  
  36.  
  37. #Sélections mini jeux
  38. fen =Tk()
  39. fen.title('Sélection des mini-jeux')
  40.  
  41.  
  42. fenetre_morpion.mainloop()
  43.  
  44.  
  45.  
  46. # def lol():
  47. #    fen_withdraw()
  48. #    fenetre_morpion.iconify()
  49.  
  50.  
  51.  
  52. SpaceInvimage=PhotoImage(file='invader.gif')
  53. morpionimage=PhotoImage(file='morpion_image.gif')
  54.  
  55. dessin=Canvas(fen, bg="white", width=301, height=501)
  56. dessin.grid(row = 0, column = 0, columnspan = 2, padx=5, pady=5)
  57.  
  58.  
  59. bouton_minijeux = Button(fen, text='morpion', command=fen.destroy)
  60. bouton_minijeux.grid(row = 0, column = 0, padx=20, pady = 50, sticky=N+W)
  61.  
  62. bouton_minijeux = Button(fen, text='spaceinvader', command=fen.destroy)
  63. bouton_minijeux.grid(row = 0, column = 1, padx=20, pady = 50, sticky=N+E)
  64.  
  65.  
  66.  
  67. message = Label(fen, text='Sélection de mini-jeux')
  68. message.grid(row=0, column=0  , padx=3 , columnspan=2, pady=3, sticky=N  )
  69.  
  70. fen.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement