Skip to main content

Tkinter-like themed UI framework for curses... New aditions to 0.2.8: setings and custom keybindings and updated README file

Project description

TKurses

tkurses is a library for tkinter like interface in curses

basic program

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

def main(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.jdon
    app.addWidget(app.Label("Hello World!", 0,0))

    app.main_loop()

curses.wrapper(main)

Widgets

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":">"}
    }
}

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.2.8.tar.gz (7.7 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.2.8-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tkurses-0.2.8.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for tkurses-0.2.8.tar.gz
Algorithm Hash digest
SHA256 80f654a290916067fea47c844eb2c9b72bb9f5fe9bdc68bf8b38f4a77fe96662
MD5 6e6c75b650eb1af8091e767e25bfebe4
BLAKE2b-256 80ceac3777be07fca1b6a348ee5f2fd6155e5466b9031597fad0d4e642d57ab9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tkurses-0.2.8-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for tkurses-0.2.8-py3-none-any.whl
Algorithm Hash digest
SHA256 664183759ea92ca77629aad1ca96d61318e66f09be718e2f9018ceee7ca0d2ce
MD5 de9eb6a7cd95afaaa71bcbfcfc2d2187
BLAKE2b-256 8805d72b163f6dc494ad83235a85139cc1c9dc36c184b026f04f3b56499c1a52

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