Skip to main content

Buttons in Linux terminal

Project description

TerminalButtons

Python curses made easy

Clicable Buttons in Linux terminal, Termux, etc

Captura de Tela 2021-08-15 às 08 03 05

Example:

from TerminalButtons import *
import curses

def example(std):
    Tb = TerminalButtons(std)
    Tb.CreateButton(positiony=CENTER,positionx=CENTER,fg=curses.COLOR_BLUE,text='hi')
    Tb.mainLoop()

curses.wrapper(example)

Methods:

CreateButton(self,positionx,positiony,fg,bg,commmand,text,row,col,typeText)
#positions = Top,Left,Bottom,Right
#fg,bg = curses COLOR (Foreground,Background Color)
#command = Function to run when click the button (without '()')
#row,col = padding
#typeText = curses BOLD,ITALIC,etc

ReqInput(self,x,y)
#x,y = coords where input will show up
#returns the string typed

AddKeyEvent(self,key,func)
#key = curses KEY
#func = Function to run when event fire

ConfigureBg(self,bg,fg)
#bg,fg = curses COLOR (will change the screen colors)

mainLoop(self)
#principal loop

ClearScreen(self)
#i need to document this?

GetMaxYX(self)
#returns the char size of terminal (x,y)

Exit(self)
#breaks the mainLoop and exit

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

TerminalButtons-1.0.0.tar.gz (3.2 kB view hashes)

Uploaded Source

Built Distribution

TerminalButtons-1.0.0-py3-none-any.whl (3.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page