J'ai essayé votre méthode mais ça ne fonctionne pas, voici le code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| from tkinter import *
from functools import partial
app= Tk()
app.geometry("600x600+200+100")
app["bg"] = "deep pink"
app.title("BUTTONTEST")
def desactivate_button():
b1.configure(state='disabled')
button.configure(state='disabled')
b1= Button(app, text='delete', fg='purple1')
b1.configure(command=partial(desactivate_button, b1))
b1.pack()
app.mainloop() |
Voici le message d'erreur:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\vasco\AppData\Local\Programs\Python\Python37-32\lib\tkinter\__init__.py", line 1702, in __call__
return self.func(*args)
TypeError: desactivate_button() takes 0 positional arguments but 1 was given
Partager