Seite 1 von 1

einige Konstanten nicht verfügbar

Verfasst: Montag 14. Juli 2014, 10:34
von Papp Nase
Hallo,

ich lerne grade das tkinter.Entry kennen und benutze dazu diese Internetseite:

http://effbot.org/tkinterbook/entry.htm
validate=
Specifies when validation should be done. You can use “focus” to validate whenever the widget gets or loses the focus, “focusin” to validate only when it gets focus, “focusout” to validate when it loses focus, “key” on any modification, and ALL for all situations. Default is NONE (no validation). (validate/Validate)
validatecommand=
A function or method to call to check if the contents is valid. The function should return a true value if the new contents is valid, or false if it isn’t. Note that this option is only used if the validate option is not NONE. (validateCommand/ValidateCommand)
Ich kann Entry verschiedene optionale Argumente übergeben, u.a. validate = {focus, focusout, key, NONE, ALL}.

Gebe ich ein: validate=focus, dann kennt der Interpreter focus nicht - in dem Modul tkinter ist focus nicht definiert, genauso nicht focusout und key, es gibt dort nur NONE und ALL.

Warum kann ich validate=focus nicht benutzen?

Re: einige Konstanten nicht verfügbar

Verfasst: Montag 14. Juli 2014, 10:39
von EyDu
Vielleicht gibt es ja einen Grund warum die Parameter in Anführungszeichen geschrieben sind ;-)

Re: einige Konstanten nicht verfügbar

Verfasst: Montag 14. Juli 2014, 10:42
von Papp Nase
danke für den Tipp - ja sorry, es ist montag morgen :-)

Re: einige Konstanten nicht verfügbar

Verfasst: Montag 14. Juli 2014, 10:49
von BlackJack
Und als Konstanten gibt es die wahrscheinlich nicht weil die spezielle Unterstützung für `validate`/`validatecommand` in der Tk-Anbindung eher unterirdisch ist.