https://github.com/henriqueslab/easy-gui-prompt
https://github.com/henriqueslab/easy-gui-prompt
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/henriqueslab/easy-gui-prompt
- Owner: HenriquesLab
- License: mit
- Created: 2024-05-24T12:16:24.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-04T15:51:22.000Z (over 1 year ago)
- Last Synced: 2025-08-24T18:50:01.118Z (9 months ago)
- Language: Python
- Size: 24.4 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Easy GUI Prompt
[](https://badge.fury.io/py/easy_gui_prompt)
[](https://pypi.org/project/easy_gui_prompt/)
[](https://opensource.org/licenses/MIT)
A Python library to simplify the creation of GUI elements in the terminal using prompt-toolkit.
## Installation
Install easy_gui_prompt using pip:
```bash
pip install easy_gui_prompt
```
## Usage
Import the `EasyGUI` class:
```python
from easy_gui_prompt import EasyGUI
```
Create an instance of `EasyGUI` with a title:
```python
gui = EasyGUI("My GUI")
```
Add GUI elements using the available methods:
```python
# Yes/No prompt
result = gui.add_yes_no("confirm", "Do you want to proceed?", remember_value=True)
# Text input
name = gui.add_text("name", "Enter your name:", remember_value=True)
# Integer range
age = gui.add_int_range("age", "Enter your age:", 18, 100, remember_value=True)
```
Save the settings to a configuration file:
```python
gui.save_settings()
```
Restore default settings:
```python
gui.restore_default_settings()
```
## Configuration
The library automatically saves user preferences to onfiguration files in `~/.easy_gui/`. This allows the GUI to remember the last entered values when `remember_value=True` is used.
You can also access the configuration directly using the `get_config` and `save_config` functions:
```python
from easy_gui_prompt import get_config, save_config
config = get_config("My GUI")
save_config("My GUI", config)
```
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE.txt) file for details.