Skip to main content

Tkinter-like themed UI framework for curses

Project description

tkurses

what is it ?

tkurses is a library for tkinter like interface in curses

basic program

import curses
import tkurses.core as core
import tkurses.widgets as widgets

def main(stdscr):
    screen = stdscr
    app = core.App(screen, "theme.json", "settings.json") # leave either of these blank to get a defaul writen to a defaultTheme.json or defaultSettings.json
    app.add_widget(widgets.Label("Hello World!", 0,0), app)

    app.mainloop()

curses.wrapper(main)

Widgets

global functions

widget.delete() # delete a widget you have created and un-render it and remove it from the apps widgets allong with all its children

Label

Declaring one

app.Label("what To Write",(posX,posY))

Button

Declaring one

app.Button("what To Write",(posX,posY),(sizeX,sizeY),on_press=function_to_run)

Input prompt

declaring one

app.Input("prompt",(posX,posY),(sizeX,sizeY),on_press=function_to_run_on_enter_pressed)

TextBox (Experemental)

Declaring one

app.TextBox((PosX,posY),(sizeX,sizeY),enterOnEnter=true)

getting current Contents

currentTextbox.text

adding Widgets to app

app.add_widget(Variable)

Theming files

example Theme

{
    "colors": {
        "background": "black",
        "forground": "white"
    },
    "input": {
        "style": "default",
        "colors": {
            "focused": {
                "background": "black",
                "forground": "white"
            }, "not-focused": {
                "forground": "black",
                "background": "white"
            }
        }
    },
    "text": {
        "colors": {
            "background": "blue",
            "forground": "black"
        },
        "theme": "None",
        "quitKeys": ["Enter","shift-enter"]
    },
    "buttons": {
        "colors": {
            "focused": { "background": "white", "forground": "black"},
            "not-focused": {"background": "black","forground": "white"}
        },
        "start": {"focused":"[","not-focused":"<"},
        "end": {"focused": "]","not-focused":">"}
    }
}

Theme options

key options explination
["input"]["style"] "box"/"default" box shows inpu as a box and defalut shows it like python input
["text"]["theme"] Anything you please Not a thing yet... to be filled in
Settings and keybinds

A recent adition to this library is the ability to add settings.json to your program (or rather the requirmen too) here is an example of what you have to have so far (not all of them work yet but will in future updates)

{
    "keybindings": {
        "Move-Focus-Forward": "TAB",
        "Move-Focus-Back": "None",
        "Move-Focus-In-Frame-Forward": "CTRL+D",
        "Move-Focus-In-Frame-Backward": "None",
        "Exit-Text-box": "CTRL+M",
        "Quit-Program": "ESC"
    }
}

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

tkurses-0.3.2.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tkurses-0.3.2-py3-none-any.whl (2.2 kB view details)

Uploaded Python 3

File details

Details for the file tkurses-0.3.2.tar.gz.

File metadata

  • Download URL: tkurses-0.3.2.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for tkurses-0.3.2.tar.gz
Algorithm Hash digest
SHA256 617bf7a0aa0d28692a3b93fa769b3a98d436339022ae50edbc8d6791fe75281b
MD5 c33d055b562aad2129dffdc98b11b75c
BLAKE2b-256 5dbe96cb7894e4be5f336403bb0fbf3b8fc6cbae08b3d1604e5e4aa62ec23744

See more details on using hashes here.

File details

Details for the file tkurses-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: tkurses-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 2.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for tkurses-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 046804fdd57c1cbb49d3cf1caa4867a89d718724741719dd0da25492d07a1d1b
MD5 5f1ed7c1a0d911a8c393f5e9567f84a3
BLAKE2b-256 3866a015b8869d44e57f62ecd22c7b831b422561fa08cf797e0f30d93f068795

See more details on using hashes here.

Supported by

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