Flexible DataFrame-based GUI builder for Colab and Jupyter using ipywidgets.
Project description
Frame2App
Frame2App is a flexible DataFrame-based GUI builder for Google Colab and Jupyter Notebook using ipywidgets.
It creates interactive GUI forms from pandas DataFrames and lets users attach any custom Python function behind any button.
Main idea
DataFrame + automatic/manual/hybrid field configuration + flexible callbacks
→ notebook GUI
Features
- Fully automatic GUI generation from a DataFrame
- Fully manual field configuration
- Hybrid mode: automatic for most fields, customized overrides for selected fields
- Flexible button names
- Flexible callback functions
- Built-in actions:
reset,clear_output,show_values,to_dataframe,validate - Validation support
- Export values as dictionary, DataFrame, or JSON
- Layouts:
vertical,grid,horizontal,accordion - Works in Google Colab and Jupyter Notebook
Installation
pip install frame2app
For Google Colab:
!pip install frame2app
from google.colab import output
output.enable_custom_widget_manager()
Basic automatic usage
import pandas as pd
from frame2app import AutoForm
sample_df = pd.DataFrame({
"age": [18, 25, 32, 45, 60],
"income": [20000, 35000, 50000, 70000, 90000],
"gender": ["Male", "Female", "Female", "Male", "Female"],
"city": ["London", "Dublin", "Paris", "London", "Berlin"],
"has_account": [True, False, True, True, False],
"target": [0, 1, 0, 1, 1]
})
def run_anything(values):
print("Values received:")
print(values)
app = AutoForm(
data=sample_df,
target="target",
title="Automatic GUI",
buttons={
"Run Anything": run_anything,
"Show Values": "show_values",
"As DataFrame": "to_dataframe",
"Reset": "reset",
"Clear Output": "clear_output",
}
)
app.display()
Hybrid automatic + customized fields
app = AutoForm(
data=sample_df,
target="target",
fields="auto",
overrides={
"age": {
"widget": "int_slider",
"min": 18,
"max": 100,
"step": 1,
"default": 30,
},
"gender": {
"widget": "radio",
"options": ["Male", "Female"],
"default": "Female",
},
"city": {
"widget": "combobox",
"options": ["London", "Dublin", "Paris", "Berlin", "New York"],
"default": "London",
},
},
buttons={
"Submit": run_anything,
"Validate": "validate",
"Reset": "reset",
},
layout="grid",
title="Hybrid Auto + Custom GUI"
)
app.display()
Fully manual fields
app = AutoForm(
data=sample_df,
fields={
"age": {
"widget": "int_slider",
"min": 18,
"max": 100,
"default": 30,
"required": True,
},
"income": {
"widget": "int_text",
"default": 50000,
"validator": lambda value: (value >= 0, "Income must be non-negative."),
},
"gender": {
"widget": "dropdown",
"options": ["Male", "Female"],
"default": "Male",
},
},
buttons={
"Process": run_anything,
"Reset": "reset",
}
)
app.display()
Supported widget names
int_sliderfloat_sliderrange_sliderfloat_range_sliderint_textfloat_textdropdowncomboboxradioselect_multiplecheckboxtextareadate_pickerpasswordfile_uploadtexthtml
Built-in button actions
buttons={
"Show Values": "show_values",
"Show DataFrame": "to_dataframe",
"Validate": "validate",
"Reset": "reset",
"Clear Output": "clear_output",
}
Custom button function
Every custom function receives the current form values as a dictionary.
def my_function(values):
print(values)
app = AutoForm(
data=sample_df,
buttons={"Run My Function": my_function}
)
Export values
values = app.get_values()
row_df = app.to_dataframe()
json_data = app.to_json()
Local development
pip install -e .
Build
pip install build twine
python -m build
Publish
twine upload dist/*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file frame2app-0.1.0.tar.gz.
File metadata
- Download URL: frame2app-0.1.0.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9cde5ec79c9af8be432f7abcf43d651f3764aa396762fd6fe3d47d2f2d09997
|
|
| MD5 |
68180af01bdef5b988072e2b30345bb3
|
|
| BLAKE2b-256 |
17ad79253a40ed59d907e5f74aef876d6adcf64b2e19eea98e7b2d813dc77053
|
File details
Details for the file frame2app-0.1.0-py3-none-any.whl.
File metadata
- Download URL: frame2app-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab0acd764e535501d3106f56d52345f33f6af47e776c1388f738e424c490d0e6
|
|
| MD5 |
f9bd5526a6078bf4900bfc1458efeca3
|
|
| BLAKE2b-256 |
375e4e74728a1b3786b91f6c4cb01ced9972f74b752408a43dc0b627b5e004c9
|