Skip to content

inputs

_inputs

Input widgets with icons.

Classes:

Name Description
FXIconLineEdit

A line edit that displays an icon on the left or right side.

FXPasswordLineEdit

A custom widget that includes a password line edit with a show/hide button.

FXValidatedLineEdit

A line edit that provides visual feedback when input is rejected.

Classes

FXIconLineEdit

FXIconLineEdit(
    icon_name: Optional[str] = None,
    icon_position: str = "left",
    parent: Optional[QWidget] = None,
)

Bases: FXThemeAware, QLineEdit


              flowchart TD
              fxgui.fxwidgets._inputs.FXIconLineEdit[FXIconLineEdit]
              fxgui.fxstyle.FXThemeAware[FXThemeAware]

                              fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets._inputs.FXIconLineEdit
                


              click fxgui.fxwidgets._inputs.FXIconLineEdit href "" "fxgui.fxwidgets._inputs.FXIconLineEdit"
              click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
            

A line edit that displays an icon on the left or right side.

The icon is theme-aware and will refresh automatically when the application theme changes.

Parameters:

Name Type Description Default
icon_name
Optional[str]

The name of the icon to display.

None
icon_position
str

The position of the icon ('left' or 'right').

'left'
parent
Optional[QWidget]

The parent widget.

None

Methods:

Name Description
resizeEvent

Reposition the icon when the line edit is resized.

Functions
resizeEvent
resizeEvent(event)

Reposition the icon when the line edit is resized.

FXPasswordLineEdit

FXPasswordLineEdit(
    parent: Optional[QWidget] = None, icon_position: str = "right"
)

Bases: FXThemeAware, QWidget


              flowchart TD
              fxgui.fxwidgets._inputs.FXPasswordLineEdit[FXPasswordLineEdit]
              fxgui.fxstyle.FXThemeAware[FXThemeAware]

                              fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets._inputs.FXPasswordLineEdit
                


              click fxgui.fxwidgets._inputs.FXPasswordLineEdit href "" "fxgui.fxwidgets._inputs.FXPasswordLineEdit"
              click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
            

A custom widget that includes a password line edit with a show/hide button.

Parameters:

Name Type Description Default
parent
Optional[QWidget]

The parent widget.

None
icon_position
str

The position of the icon ('left' or 'right').

'right'

Methods:

Name Description
toggle_reveal

Toggles the echo mode between password and normal, and changes the

Functions
toggle_reveal
toggle_reveal()

Toggles the echo mode between password and normal, and changes the icon of the reveal button accordingly.

FXValidatedLineEdit

FXValidatedLineEdit(
    parent: Optional[QWidget] = None,
    shake_amplitude: int = 4,
    shake_duration: int = 300,
    flash_duration: int = 400,
)

Bases: FXThemeAware, QLineEdit


              flowchart TD
              fxgui.fxwidgets._inputs.FXValidatedLineEdit[FXValidatedLineEdit]
              fxgui.fxstyle.FXThemeAware[FXThemeAware]

                              fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets._inputs.FXValidatedLineEdit
                


              click fxgui.fxwidgets._inputs.FXValidatedLineEdit href "" "fxgui.fxwidgets._inputs.FXValidatedLineEdit"
              click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
            

A line edit that provides visual feedback when input is rejected.

When a validator rejects input (e.g., typing an invalid character), this widget shows a brief shake animation with a red border flash to indicate to the user that their input was not accepted.

The error color is theme-aware and uses the feedback "error" color from the current theme.

Parameters:

Name Type Description Default
parent
Optional[QWidget]

The parent widget.

None
shake_amplitude
int

Maximum horizontal displacement in pixels.

4
shake_duration
int

Total duration of shake animation in milliseconds.

300
flash_duration
int

Duration of red border flash in milliseconds.

400

Examples:

>>> from qtpy.QtWidgets import QLineEdit
>>> from fxgui.fxwidgets import FXValidatedLineEdit, FXCamelCaseValidator
>>> line_edit = FXValidatedLineEdit()
>>> line_edit.setValidator(FXCamelCaseValidator())
>>> line_edit.setPlaceholderText("camelCase only")

Methods:

Name Description
keyPressEvent

Intercept key presses to detect rejected input.

Functions
keyPressEvent
keyPressEvent(event: QKeyEvent) -> None

Intercept key presses to detect rejected input.

Parameters:

Name Type Description Default
event QKeyEvent

The key event.

required