TextInput: a text input who instance vkeyboard if needed

# Jump directly to Examples

TextInput: a text input who instance vkeyboard if needed

class pymt.ui.widgets.composed.textinput.MTTextInput(**kwargs)

Bases: pymt.ui.widgets.button.MTButton

A text input widget is a simple label widget that will pop up a virtual keyboard when touched any input of the virtual keyboard will then have effect on the TextInput widget.

New in version 0.5.1: Support of scrolling textarea, controlled by scroll attribute. You can now scroll inside the text area without editing text.

Parameters :
keyboard: MTVkeyboard object, default to None

Use another MTVKeyboard than the default one

keyboard_to_root: bool, defaults to False.

Indicate whether the keyboard should be attached to the root window. If True, this will have the effect of the keyboard being raised above other widgets.

keyboard_type: str, default to config.

Configuration section is ‘widgets’, token ‘keyboard_type’. Can be one of ‘virtual’ or ‘real’. If real, the virtual keyboard will be not showed

password: bool, default to False

If True, the label will be showed with star

group: str, default to random

If the group is the same for multiple text input You can switch between them with TAB, and use the same keyboard.

switch: bool, default to True

If True, a switch button will be show to switch from real or virtual keyboard

scroll: bool, default to True

If True, the scrolling of a text area is allowed.

scroll_trigger: int, default to 10

If scrolling is detected, don’t fire event to show/hide keyboard.

Events :
on_text_change (text)

Fired when the content of text input is changed

on_text_validate ()

Fired when the text is validate (when ENTER is hit on keyboard)

deactivate_group()

Deactivate all widgets in the group

focus_next()

Focus the next textinput in the list

group

Return information (keyboard/widget list) from the current group of the widget

hide_keyboard()

Hide the associed keyboard of this widget.

is_active_input

Return True if the input is active

keyboard_to_root

If True, the keyboard is added to root window, not to parent window.

keyboard_type

Keyboard type (virtual or real)

notify_error()

Call this function to make animation on background as an error

password

Boolean to activate the password mode on the textinput. If true, it will show star instead of real characters

scroll

Boolean to control the scrolling of the textinput content

scroll_trigger

If the scroll if more than scroll_trigger, no event will be dispatched, and no show/hide of keyboard.

show_keyboard()

Show the associed keyboard of this widget.

value

Get/set the value of the label

Examples

File ui_widgets_composed_textinput.py

# Text input widget with a switch to use hardware keyboard or not
from pymt import *

wid = MTTextInput()

@wid.event
def on_text_change(text):
    print 'Text have been changed (not validated):', text

runTouchApp(wid)

Table Of Contents

Previous topic

TextArea: a multiline text input, based on TextInput

Next topic

Video widget: provide a video container

This Page