text_input

This module defines the following constants:

InputText options
  • BGUI_INPUT_NONE = 0
  • BGUI_INPUT_SELECT_ALL = 1
  • BGUI_INPUT_DEFAULT = BGUI_INPUT_NONE
class bgui.text_input.TextInput(parent, name=None, text='', prefix='', font=None, pt_size=None, color=None, aspect=None, size=[1, 1], pos=[0, 0], sub_theme='', input_options=0, options=0)

Bases: bgui.widget.Widget

Widget for getting text input

Parameters:
  • parent – the widget’s parent
  • name – the name of the widget
  • text – the text to display (this can be changed later via the text property)
  • prefix – prefix text displayed before user input, cannot be edited by user (this can be changed later via the prefix property)
  • font – the font to use
  • pt_size – the point size of the text to draw
  • color – color of the font for this widget
  • aspect – constrain the widget size to a specified aspect ratio
  • size – a tuple containing the width and height
  • pos – a tuple containing the x and y position
  • sub_theme – name of a sub_theme defined in the theme file (similar to CSS classes)
  • options – various other options
theme_section = 'TextInput'
theme_options = {'InactiveBorderColor': (0, 0, 0, 0), 'HighlightColor': (0.6, 0.6, 0.6, 0.5), 'TextColor': (1, 1, 1, 1), 'FrameColor': (0, 0, 0, 0), 'BorderColor': (0, 0, 0, 0), 'LabelSubTheme': '', 'InactiveHighlightColor': (0.6, 0.6, 0.6, 0.5), 'BorderSize': 0, 'InactiveBorderSize': 0, 'InactiveFrameColor': (0, 0, 0, 0), 'InactiveTextColor': (1, 1, 1, 1)}
text
prefix
on_enter_key

A callback for when the enter key is pressed while the TextInput has focus

select_all()

Change the selection to include all of the text

select_none()

Change the selection to include none of the text

activate()
deactivate()
swapcolors(state=0)
update_selection()
find_mouse_slice(pos)
calc_mouse_cursor(pos)