Complete API documentation for EZInput classes and methods
# Recommended: Auto-detects environment
from ezinput import EZInput
# Alternative: Import specific implementation
from ezinput import EZInputJupyter # For Jupyter notebooks
from ezinput import EZInputPrompt # For terminal
EZInput automatically detects whether you're in a Jupyter notebook or terminal and uses the appropriate implementation. In most cases, you should use from ezinput import EZInput.
EZInput(title: str)Main class for creating unified GUIs that work in both Jupyter and terminal.
title (str): Unique identifier for this GUI. Used for configuration file naming and value persistence. Should be descriptive and unique per application.gui = EZInput("image_analysis_v2")
# Config saved to: ~/.ezinput/image_analysis_v2.yml
Each distinct GUI should have a unique title to avoid configuration conflicts:
"preprocessing_v1", "cell_segmentation", "user_johndoe_analysis""test", "gui", "main"show()Display the GUI and collect user input.
gui.show() # Display the GUI
get_values() → dictReturns a dictionary of all widget objects indexed by their unique_tag.
values = gui.get_values()
threshold_value = values["threshold"].value
method_value = values["method"].value
__getitem__(unique_tag: str) → widgetAccess a widget by its unique_tag using dictionary-style indexing.
threshold_widget = gui["threshold"]
print(threshold_widget.value)
# Update value
gui["threshold"].value = 0.8
save_parameters(filename: str)Save current parameter values to a YAML file.
~/.ezinput/filename# Save to default location
gui.save_parameters("optimal_params.yml")
# Saved to: ~/.ezinput/optimal_params.yml
# Save to specific path
gui.save_parameters("/path/to/configs/experiment1.yml")
load_parameters(filename: str)Load parameter values from a YAML file. Call before adding widgets to use loaded values as defaults.
gui = EZInput("analysis")
gui.load_parameters("optimal_params.yml") # Load first
# Widgets will use loaded values as defaults
threshold = gui.add_float_range("thresh", "Threshold:", 0, 1)
gui.show()
remember_value(unique_tag: str)Mark a widget's value to be remembered across sessions.
method = gui.add_dropdown("method", ["A", "B"], "Method:")
gui.remember_value("method") # Remember this value
# Next run: method will default to previously selected value
For detailed widget documentation, see the Widget Reference.
| Method | Widget Type | Availability |
|---|---|---|
add_text() |
Single-line text input | Both |
add_text_area() |
Multi-line text input | Both |
add_int_range() |
Integer slider/input with bounds | Both |
add_float_range() |
Float slider/input with bounds | Both |
add_int_text() |
Integer input (no bounds) | Both |
add_float_text() |
Float input (no bounds) | Both |
add_bounded_int_text() |
Integer with validation | Both |
add_bounded_float_text() |
Float with validation | Both |
add_check() |
Boolean checkbox/yes-no | Both |
add_dropdown() |
Selection from list | Both |
add_file_upload() |
Visual file picker | Jupyter only |
add_path_completer() |
Path autocomplete | Terminal only |
add_label() |
Static text/header | Both |
add_output() |
Output display area | Jupyter only |
add_HTML() |
Rich HTML content | Jupyter only |
add_callback() |
Action button/execution | Both |
ezinput <notebook.ipynb>Execute a Jupyter notebook from the terminal. EZInput GUIs in the notebook will appear as terminal prompts.
# Run notebook from terminal
ezinput my_analysis.ipynb
# GUIs appear as interactive prompts
# Values are collected, then notebook executes
When multiple sources provide values for a widget:
load_parameters()remember_value=True parameterConfiguration files are stored in:
~/.ezinput/{title}.yml
You can also specify absolute paths for save_parameters() and load_parameters().
Widgets appear in the order they are added:
gui.add_label(value="=== Section 1 ===") # First
gui.add_text("name", "Name:") # Second
gui.add_int_range("age", "Age:", 0, 120) # Third
gui.show() # Displays in this order