HenriquesLab / easy-gui-prompt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Easy GUI Prompt

PyPI version Python versions License: MIT

A Python library to simplify the creation of GUI elements in the terminal using prompt-toolkit.

Installation

Install easy_gui_prompt using pip:

pip install easy_gui_prompt

Usage

Import the EasyGUI class:

from easy_gui_prompt import EasyGUI

Create an instance of EasyGUI with a title:

gui = EasyGUI("My GUI")

Add GUI elements using the available methods:

# 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:

gui.save_settings()

Restore default settings:

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:

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 file for details.

About

License:MIT License


Languages

Language:Python 90.9%Language:Makefile 9.1%