Python Tkinter

Résolu/Fermé
TheSnake ! - 29 sept. 2010 à 11:57
 TheSnake ! - 30 sept. 2010 à 09:43
Bonjour,


Mon problème est simple.
La solution est plus compliqué.

Imaginons un code python très simple :
==================================
from Tkinter import *

def toto():
entry.state(NORMAL)

root = Tk()
entry = Entry(root, state=DISABLED).place(x=10, y=10)

button = Button(root, text="Ajouter", command=toto).place(x=10, y=40)
root.config(height=100,width=150)

root.mainloop()
==================================

Voici le problème :

entry.state=NORMAL
AttributeError: 'NoneType' object has no attribute 'state'

Je soupçonne que la fonction ".place()" ne me permet pas d'utiliser les fonctions du widget Entry.

Avez vous une solution pour résoudre le problème ?

Cordialement,

TheSnake !

1 réponse

Bonjour,

J'ai posé mon problème sur d'autre site ou j'ai eu la solution.
Je la pose pour ceux qui veulent connaitre la solution !

====================
from Tkinter import *

def toto():
entry.state(NORMAL)

root = Tk()
entry = Entry(root, state=DISABLED)
entry.place(x=10, y=10)

button = Button(root, text="Ajouter", command=toto).place(x=10, y=40)
root.config(height=100,width=150)

root.mainloop()
====================


Merci tout de même !
0