spino.gui_toolkit.widget.MyTextField module

class spino.gui_toolkit.widget.MyTextField.MyTextField(parent, row, column, text, label_text=None, color='#AAAAAA', columnspan=2, rowspan=1, height=1, **kwargs)[source]

Bases: Frame

A custom text field widget that wraps tkinter’s Text in a Frame.

This class creates a multi-line text input field with customizable appearance and behavior, inheriting from Frame to provide better grid layout management and consistent styling. It can optionally include a label.

Variables:

text_widget (Text) – The underlying tkinter Text widget

Parameters:
__init__(parent, row, column, text, label_text=None, color='#AAAAAA', columnspan=2, rowspan=1, height=1, **kwargs)[source]

Initialize the MyTextField widget.

Parameters:
  • parent (Any) – The parent widget

  • row (int) – Row position in the parent’s grid

  • column (int) – Column position in the parent’s grid

  • text (str) – Initial text to display in the text field

  • label_text (Optional[str]) – Optional text to display as a label before the text field

  • color (str) – Background color of the containing frame

  • columnspan (int) – Number of columns the widget should span

  • rowspan (int) – Number of rows the widget should span

  • height (int) – Height of the text field in lines

  • **kwargs – Additional keyword arguments passed to the Text widget

Return type:

None

insert_text(text)[source]

Replace the current text in the text field with new text.

Parameters:

text (str) – The new text to display

Return type:

None

get_text()[source]

Get the current text from the text field.

Returns:

The current text in the text field, with leading/trailing whitespace removed

Return type:

str

set_status(status)[source]

Enable or disable the text field.

Parameters:

status – The state to set the text field to (‘normal’, ‘disabled’, etc.)

Return type:

None