GUIBRUSHR.GUI.WIDGET.MyTextField module

class GUIBRUSHR.GUI.WIDGET.MyTextField.MyTextField(parent: Any, row: int, column: int, text: str, label_text: str | None = None, color: str = '#AAAAAA', columnspan: int = 2, rowspan: int = 1, height: int = 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.

text_widget

The underlying tkinter Text widget

Type:

Text

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

Initialize the MyTextField widget.

Parameters:
  • parent – The parent widget

  • row – Row position in the parent’s grid

  • column – Column position in the parent’s grid

  • text – Initial text to display in the text field

  • label_text – Optional text to display as a label before the text field

  • color – Background color of the containing frame

  • columnspan – Number of columns the widget should span

  • rowspan – Number of rows the widget should span

  • height – Height of the text field in lines

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

insert_text(text: str) None[source]

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

Parameters:

text – The new text to display

get_text() str[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) None[source]

Enable or disable the text field.

Parameters:

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