Bonjour,
Je rencontre encore des difficultés avec Tk inter.
Je n'arrive pas à faire afficher mon cadre et un bouton. En mettant button_start.pack(), j'ai le bouton mais plus le cadre.
Sur le tuto de Swinnen, cela ne semble pas poser problème mais je ne vois pas ce qui me manque
Des suggestions ?
Merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 from tkinter import * CASE_SIZE = 20 CASE_NUMBER = 20 class Application(Canvas): def __init__(self, boss=None): super().__init__() self.terrain() game_status = 0 button_start = Button(self, text ='Stop/Start',command =self.launch_game) # button_start.pack() self.pack() def terrain(self): size = CASE_NUMBER*CASE_SIZE self.configure(width=size, height=size, bg="black") def launch_game(self): game_status = not(game_status) launch = Application() launch.mainloop()
Partager