GUI Backends

This section documents the different GUI backend implementations.

Qt Backend

Main GUI builder class that creates Qt applications from JSON configuration. Compatible with both PySide6 and PyQt6 via qtpy.

class vibegui.qt.qt_gui_builder.GuiBuilder(*args, **kwargs)[source]

Bases: ButtonHandlerMixin, ConfigLoaderMixin, CallbackManagerMixin, ValidationMixin, DataPersistenceMixin, WidgetFactoryMixin, FieldStateMixin, QMainWindow

Main GUI builder class that creates Qt applications from JSON configuration.

Parameters:
  • config_path (Optional[str])

  • config_dict (Optional[Dict[str, Any]])

formSubmitted

alias of dict

fieldChanged

alias of str

static create_and_run(config_path=None, config_dict=None, app_args=None)[source]

Create and run a GUI application.

Parameters:
  • config_path (str | None) – Path to JSON configuration file

  • config_dict (Dict[str, Any] | None) – Configuration dictionary (alternative to config_path)

  • app_args (list | None) – Arguments for QApplication (defaults to sys.argv)

Returns:

GuiBuilder instance

Return type:

GuiBuilder

Tkinter Backend

Main GUI builder class that creates tkinter applications from JSON configuration.

class vibegui.tk.tk_gui_builder.TkGuiBuilder(config_path=None, config_dict=None)[source]

Bases: ButtonHandlerMixin, ConfigLoaderMixin, CallbackManagerMixin, ValidationMixin, DataPersistenceMixin, WidgetFactoryMixin, FieldStateMixin

Main GUI builder class that creates tkinter applications from JSON configuration.

Parameters:
  • config_path (Optional[str])

  • config_dict (Optional[Dict[str, Any]])

run()[source]

Run the GUI application (start the main loop).

Return type:

None

show()[source]

Show the GUI window and bring it to the front.

Return type:

None

hide()[source]

Hide the GUI window.

Return type:

None

classmethod create_and_run(config_path=None, config_dict=None)[source]

Create a GUI builder and run it immediately.

Parameters:
  • config_path (str | None) – Path to JSON configuration file

  • config_dict (Dict[str, Any] | None) – Configuration dictionary (alternative to config_path)

Returns:

The created GUI builder instance

Return type:

TkGuiBuilder

close()[source]

Close the GUI application.

Return type:

None

__del__()[source]

Cleanup when the object is destroyed.

Return type:

None

Widget factory for creating tkinter widgets based on field configurations.

class vibegui.tk.tk_widget_factory.CustomColorButton(parent, initial_color='#ffffff', callback=None)[source]

Bases: Button

Custom button widget for color selection.

Parameters:
  • parent (Widget)

  • initial_color (str)

  • callback (Callable | None)

get_color()[source]

Get the current color.

Return type:

str

set_color(color)[source]

Set the current color.

Parameters:

color (str)

Return type:

None

class vibegui.tk.tk_widget_factory.RadioButtonGroup(parent)[source]

Bases: object

Container for radio button groups.

Parameters:

parent (Widget)

add_button(text, value, **kwargs)[source]

Add a radio button to the group.

Parameters:
Return type:

Radiobutton

get_value()[source]

Get the selected value.

Return type:

str

set_value(value)[source]

Set the selected value.

Parameters:

value (str)

Return type:

None

class vibegui.tk.tk_widget_factory.TkWidgetFactory[source]

Bases: NestedValueMixin

Factory class for creating tkinter widgets based on field configurations.

set_theme_colors(theme_colors)[source]

Set theme colors for widgets.

Parameters:

theme_colors (Dict[str, str])

Return type:

None

create_widget(parent, field_config)[source]

Create a widget based on the field configuration.

Parameters:
Return type:

Widget

create_label(parent, field_config)[source]

Create a label for the field.

Parameters:
Return type:

Label

add_change_callback(field_name, callback)[source]

Add a change callback for a field.

Parameters:
Return type:

None

get_widget_value(field_name)[source]

Get the current value of a widget.

Parameters:

field_name (str)

Return type:

Any

set_widget_value(field_name, value)[source]

Set the value of a widget.

Parameters:
  • field_name (str)

  • value (Any)

Return type:

bool

clear_all_widgets()[source]

Clear all widget values to their defaults.

Return type:

None

wxPython Backend

wxPython GUI builder class that creates applications from JSON configuration.

class vibegui.wx.wx_gui_builder.WxGuiBuilder(*args, **kwargs)[source]

Bases: CallbackManagerMixin, ValidationMixin, DataPersistenceMixin, WidgetFactoryMixin, FieldStateMixin, ButtonHandlerMixin, ConfigLoaderMixin, Frame

wxPython GUI builder class that creates applications from JSON configuration.

Parameters:
  • config_path (str | None)

  • config_dict (Dict[str, Any] | None)

  • parent (wx.Window | None)

static create_and_run(config_path=None, config_dict=None)[source]

Create and run a wxPython GUI application.

Parameters:
Return type:

WxGuiBuilder

wxPython widget factory for creating widgets based on field configurations.

class vibegui.wx.wx_widget_factory.WxCustomColorButton(*args, **kwargs)[source]

Bases: Button

Custom button widget for color selection in wxPython.

Parameters:
  • parent (wx.Window)

  • initial_color (wx.Colour)

get_color()[source]

Get the current selected color.

Return type:

wx.Colour

set_color(color)[source]

Set the current color.

Parameters:

color (wx.Colour)

Return type:

None

class vibegui.wx.wx_widget_factory.WxCustomFileButton(*args, **kwargs)[source]

Bases: Button

Custom button widget for file selection in wxPython.

Parameters:
  • parent (wx.Window)

  • file_mode (str)

get_file_path()[source]

Get the selected file path.

Return type:

str

set_file_path(path)[source]

Set the file path.

Parameters:

path (str)

Return type:

None

class vibegui.wx.wx_widget_factory.WxWidgetFactory[source]

Bases: NestedValueMixin

Factory class for creating wxPython widgets from field configurations.

create_widget(parent, field_config)[source]

Create a widget based on the field configuration.

Parameters:
Return type:

wx.Window | None

create_label(parent, field_config)[source]

Create a label for the field.

Parameters:
Return type:

wx.StaticText

get_widget_value(field_name)[source]

Get the current value of a widget.

Parameters:

field_name (str)

Return type:

Any

set_widget_value(field_name, value)[source]

Set the value of a widget.

Parameters:
  • field_name (str)

  • value (Any)

Return type:

bool

clear_all_widgets()[source]

Clear all widget values to their defaults.

Return type:

None

GTK Backend

Main GUI builder class that creates GTK applications from JSON configuration.

class vibegui.gtk.gtk_gui_builder.GtkGuiBuilder(config_path=None, config_dict=None, submit_callback=None, cancel_callback=None)[source]

Bases: CallbackManagerMixin, ValidationMixin, DataPersistenceMixin, WidgetFactoryMixin, FieldStateMixin, ButtonHandlerMixin, ConfigLoaderMixin

Main GUI builder class that creates GTK applications from JSON configuration.

Parameters:
show()[source]

Show the GUI window and bring it to the front (cross-platform).

Return type:

None

hide()[source]

Hide the GUI window.

Return type:

None

run()[source]

Run the GUI application (start the main loop).

Return type:

None

classmethod create_and_run(config_path=None, config_dict=None)[source]

Create a GUI builder and run it immediately.

Parameters:
  • config_path (str | None) – Path to JSON configuration file

  • config_dict (Dict[str, Any] | None) – Configuration dictionary (alternative to config_path)

Returns:

The created GUI builder instance

Return type:

GtkGuiBuilder

close()[source]

Close the GUI application.

Return type:

None

__del__()[source]

Cleanup when the object is destroyed.

Return type:

None

property backend: str

Return the backend name with version info.

Widget factory for creating GTK widgets from field configurations.

class vibegui.gtk.gtk_widget_factory.GtkWidgetFactory[source]

Bases: NestedValueMixin

Factory for creating GTK widgets from field configurations.

create_label(parent, field_config)[source]

Create a label for a field.

Parameters:
  • parent (gi.repository.Gtk.Widget)

  • field_config (FieldConfig)

Return type:

gi.repository.Gtk.Label

create_widget(parent, field_config)[source]

Create a widget based on the field configuration.

Parameters:
  • parent (gi.repository.Gtk.Widget)

  • field_config (FieldConfig)

Return type:

gi.repository.Gtk.Widget | None

get_widget_value(field_name)[source]

Get the current value of a widget.

Parameters:

field_name (str)

Return type:

Any

set_widget_value(field_name, value)[source]

Set the value of a widget.

Parameters:
  • field_name (str)

  • value (Any)

Return type:

bool

clear_all_widgets()[source]

Clear all widget values.

Return type:

None

add_change_callback(field_name, callback)[source]

Add a change callback for a field.

Parameters:
Return type:

None

Flet Backend

Main GUI builder class that creates Flet applications from JSON configuration.

class vibegui.flet.flet_gui_builder.FletGuiBuilder(config_path=None, config_dict=None)[source]

Bases: CallbackManagerMixin, ValidationMixin, DataPersistenceMixin, WidgetFactoryMixin, FieldStateMixin, ButtonHandlerMixin, ConfigLoaderMixin

Main GUI builder class that creates Flet applications from JSON configuration.

Parameters:
  • config_path (Optional[str])

  • config_dict (Optional[Dict[str, Any]])

set_form_data(data)[source]

Set form data - override to add page.update().

Parameters:

data (Dict[str, Any])

Return type:

None

clear_form()[source]

Clear form - override to add page.update().

Return type:

None

set_field_value(field_name, value)[source]

Set field value - override to add page.update().

Parameters:
  • field_name (str)

  • value (Any)

Return type:

bool

run()[source]

Run the Flet application.

Return type:

None

show()[source]

Show the GUI (alias for run in Flet).

Return type:

None

close()[source]

Close the GUI application.

Return type:

None

static create_and_run(config_path=None, config_dict=None, submit_callback=None)[source]

Convenience method to create and run a GUI in one call.

Parameters:
  • config_path (str | None) – Path to JSON configuration file

  • config_dict (Dict[str, Any] | None) – Configuration dictionary (alternative to config_path)

  • submit_callback (Callable | None) – Optional callback for form submission

Returns:

FletGuiBuilder instance

Return type:

FletGuiBuilder

Widget factory for creating Flet controls based on field configurations.

class vibegui.flet.flet_widget_factory.FletWidgetFactory[source]

Bases: NestedValueMixin

Factory class for creating Flet controls based on field configurations.

create_widget(field_config)[source]

Create a Flet control based on the field configuration.

Parameters:

field_config (FieldConfig)

Return type:

flet.Control

get_value(field_name)[source]

Get the current value of a widget.

Parameters:

field_name (str)

Return type:

Any

set_value(field_name, value)[source]

Set the value of a widget.

Parameters:
  • field_name (str)

  • value (Any)

Return type:

None

get_widget_value(field_name)[source]

Alias for get_value to match NestedValueMixin interface.

Parameters:

field_name (str)

Return type:

Any

set_widget_value(field_name, value)[source]

Alias for set_value to match NestedValueMixin interface.

Parameters:
  • field_name (str)

  • value (Any)

Return type:

bool

clear_all_widgets()[source]

Clear all widget values to their defaults.

Return type:

None

add_change_callback(field_name, callback)[source]

Add a callback to be called when a field’s value changes.

Parameters:
Return type:

None