problème de redémarrage de la fenêtre tkinter
Bonjour, je voulais vous demander le cause de mon problème, lorsque je ferme la fenêtre tkinter, et que je réexécute le programme, voici ce qu'il m'indique :
Code:
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
| Traceback (most recent call last):
File "C:/Users/Dell/Desktop/python/test 3.py", line 6, in <module>
File "C:\Users\Dell\AppData\Local\Programs\Python\Python312\Lib\tkinter\__init__.py", line 2726, in __init__
Widget.__init__(self, master, 'button', cnf, kw)
File "C:\Users\Dell\AppData\Local\Programs\Python\Python312\Lib\tkinter\__init__.py", line 2648, in __init__
self.tk.call(
can't invoke "button" command: application has been destroyed
programme:
import tkinter as tk
fen = tk.Tk()
loop1 = 1
while loop1 == 1:
b1 = tk.Button(fen, text=("forme 1"), width=50)
b1.pack(padx=10, pady=10)
compteclick = 0
def quandclické(event):
global compteclick
compteclick = compteclick + 1
if compteclick ==1:
#action
fen.destroy()
b1.bind("<ButtonRelease-1>", quandclické)
fen.mainloop()
#action |
merci d'avance.