hscommon.gui.text_field¶
TextField () |
Cross-toolkit text field. |
TextFieldView |
Expected interface for TextField ’s view. |
-
class
hscommon.gui.text_field.
TextField
¶ Cross-toolkit text field.
Represents a UI element allowing the user to input a text value. Its main attribute is
text
which acts as the store of the said value.When our model value isn’t a string, we have a built-in parsing/formatting mechanism allowing us to directly retrieve/set our non-string value through
value
.Subclasses
GUIObject
. Expected view:TextFieldView
.-
_format
(value)¶ (Virtual) Formats
value
to put intotext
.Returns the formatted version of
value
. Called whenevervalue
changes.
-
_parse
(text)¶ (Virtual) Parses
text
to put intovalue
.Returns the parsed version of
text
. Called whenevertext
changes.
-
_update
(newvalue)¶ (Virtual) Called whenever we have a new value.
Whenever our text/value store changes to a new value (different from the old one), this method is called. By default, it does nothing but you can override it if you want.
-
_view_updated
()¶ (Virtual) Called after
view
has been set.Doing nothing by default, this method is called after
view
has been set (it isn’t called when it’s unset, however). Use this for initialization code that requires a view (which is often the whole of the initialization code).
-
-
class
hscommon.gui.text_field.
TextFieldView
¶ Expected interface for
TextField
’s view.Not actually used in the code. For documentation purposes only.
Our view is expected to sync with
TextField.text
“both ways”, that is, update the model’s text when the user types something, but also update the text field whenrefresh()
is called.-
refresh
()¶ Refreshes the contents of the input widget.
Ensures that the contents of the input widget is actually
TextField.text
.
-