Core Module¶
Main GuiBuilder Class¶
- class vibegui.GuiBuilder(config_path=None, config_dict=None, backend=None)[source]¶
Bases:
objectUnified GUI builder that automatically selects the appropriate backend.
This class provides a consistent interface that works with Qt, wxPython, tkinter, and GTK backends, automatically selecting the available backend or using the one specified via set_backend().
- Parameters:
- builder¶
The underlying backend-specific builder instance
Example
Simplest usage - create and run immediately:
>>> from vibegui import GuiBuilder >>> GuiBuilder.create_and_run('config.json')
Force a specific backend:
>>> from vibegui import set_backend, GuiBuilder >>> set_backend('tk') >>> GuiBuilder.create_and_run('config.json')
For Qt backend, create QApplication first:
>>> from vibegui import GuiBuilder >>> from qtpy.QtWidgets import QApplication >>> import sys >>> app = QApplication(sys.argv) >>> gui = GuiBuilder('config.json') >>> gui.show() >>> app.exec()
For tkinter backend:
>>> from vibegui import set_backend, GuiBuilder >>> set_backend('tk') >>> gui = GuiBuilder('config.json') >>> gui.show() >>> gui.run()
Use with configuration dictionary:
>>> config = {"window": {"title": "My App"}, "fields": [...]} >>> GuiBuilder.create_and_run(config_dict=config)
- set_submit_callback(callback)[source]¶
Set a callback function to be called when the form is submitted.
- Parameters:
callback (Callable)
- Return type:
None
- set_cancel_callback(callback)[source]¶
Set a callback function to be called when the form is cancelled.
- Parameters:
callback (Callable)
- Return type:
None
- set_custom_button_callback(button_name, callback)[source]¶
Set a callback function to be called when a custom button is clicked.
- remove_custom_button_callback(button_name)[source]¶
Remove a custom button callback.
- Parameters:
button_name (str)
- Return type:
None
- save_data_to_file(data_file_path, include_empty=True)[source]¶
Save current form data to a JSON file.
- __getattr__(name)[source]¶
Forward attribute access to the underlying builder.
This allows access to backend-specific attributes like Qt Signals (fieldChanged, formSubmitted, formCancelled).
Backend Management¶
Backend detection and selection for vibegui. Supports Qt (via qtpy), wxPython, tkinter, and GTK backends.
- class vibegui.backend.BackendManager[source]¶
Bases:
objectManages GUI backend selection and availability.
- SUPPORTED_BACKENDS = ['qt', 'wx', 'tk', 'gtk', 'flet']¶
- DEFAULT_BACKEND = 'qt'¶