![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Easy TUI
es una biblioteca de Python que permite crear interfaces de usuario de texto (TUI) simples y manejables. Utiliza simple_screen
para manejar la pantalla y proporciona una estructura básica para crear y gestionar controles como botones, entradas y etiquetas.
Puedes instalar la biblioteca utilizando pip:
pip install easy_tui
Primero, importa las bibliotecas necesarias y define algunas variables globales:
import easy_tui as eTUI
from easy_tui import controls
Define tus controles utilizando las clases proporcionadas. Por ejemplo, una etiqueta (Label
), una entrada de texto (Entry
), y un botón (KeyButton
):
label = controls.Label(col=10, fila=5, text="Nombre:")
entry = controls.Entry(col=18, fila=5, label="Nombre")
button = controls.KeyButton(col=10, fila=10, key=eTUI.ENTER, label="Enviar", command=mi_funcion)
Usa la función loop
para manejar la interacción del usuario y actualizar la pantalla:
eTUI.loop()
import easy_tui as eTUI
from easy_tui import controls
hello = controls.Label(25, 3, "Hola, mundo")
nombre = controls.Entry(25, 4, "Nombre: ")
apellidos = controls.Entry(25, 5, "Apellidos: ")
def cambiaNombre():
hello.text = f"Hola, {nombre.value} {apellidos.value}"
def limpiaTodo():
nombre.value = ""
apellidos.value = ""
cambiaNombre()
f1 = controls.KeyButton(0, key=eTUI.F1, label="Reset", command=limpiaTodo)
f2 = controls.KeyButton(16,key=eTUI.F2, command=cambiaNombre, label="Saluda")
eTUI.loop()
Nota: Las teclas y controles para modificacion basica de la pantalla se heredan de simple_screen y pueden ser invocados usando eTUI. Así, el locate de simple_screen se transforma en
eTUI.locate(columna, fila, texto)
y las teclas F de simple_screen, por ejemplo F2 en
eTUI.F2
los atributos de pantalla, tales como A_INVERSE se usan igual
eTUI.A_INVERSE.on()
... (pintar cosas)
eTUI.A_INVERSE.off()
Finalmente el ancho del control no se controla.
Control
__init__(self, col=0, fila=0, ancho=16, alto=1)
: Inicializa el control.draw(self)
: Método abstracto para dibujar el control.Label(Control)
__init__(self, col=0, fila=0, text="Label")
: Inicializa una etiqueta.draw(self)
: Dibuja la etiqueta en la posición especificada.Entry(Control, TabulatableMixin)
__init__(self, col=0, fila=0, label="", ancho=16)
: Inicializa una entrada de texto.draw(self)
: Dibuja la entrada de texto.handle_input(self, key)
: Maneja la entrada del usuario.KeyButton(Control, ButtonMixin)
__init__(self, col=0, fila=LAST_ROW, key=None, command=None, label="")
: Inicializa un botón con una tecla específica.click(self)
: Ejecuta el comando asociado al botón.draw(self)
: Dibuja el botón.Este proyecto está licenciado bajo la Licencia MIT.
Con esta estructura, podrás crear aplicaciones de consola simples y efectivas usando simple_screen
y easy_tui
. ¡Disfruta programando!
FAQs
A miniTUI with the ability to handle simple keyboard events in a terminal.
We found that easy-tui demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.