Skip to main content

TkZero - a sane and Pythonic wrapper around Tkinter.

Project description

TkZero

PyPI Version Build Status Code Coverage License

A lightweight and Pythonic wrapper around Tkinter.

Documentation is available on GitHub pages. You can find the raw HTML for the docs in the docs/ directory. pdoc is used to generate the documentation.

You can find examples in the Examples/ directory and tests in the Tests/ directory.

Installation

Using PyPI

Windows:

pip install TkZero

macOS and Linux:

pip3 install TkZero

You may need to use the user (-U) flag to install if you are not using a virtual environment!

From source

Make sure you have Git before following these steps. If you are on Windows, I highly suggest you install the Windows Terminal as it's much better than the command prompt.

  1. cd into your project root.
  2. Run git clone https://github.com/UnsignedArduino/TkZero
  3. Run cd TkZero
  4. Install TkZero's dependencies with pip install -r requirements.txt. (pip3 on Linux and macOS - you may also need to use the user (-U) flag if you are not using a virtual environment)

That's it!

Basic Usage

import tkinter as tk

from TkZero.Button import Button
from TkZero.Entry import Entry
from TkZero.Label import Label
from TkZero.MainWindow import MainWindow

# Make the main window and give it a title
root = MainWindow()
root.title = "Simple Entry Example"

# Create a label and grid it
Label(root, text="Username: ").grid(row=0, column=0, sticky=tk.NW)

# Create an entry and grid it
username = Entry(root, width=30)
username.grid(row=0, column=1, sticky=tk.NW)

# Create more labels and entries
Label(root, text="Password: ").grid(row=1, column=0, sticky=tk.NW)

password = Entry(root, width=30, show="*")
password.grid(row=1, column=1, sticky=tk.NW)


# "Submit" the form
def submit():
    root.enabled = False
    print(username.value)
    print(password.value)


# Create a button to "submit"
submit = Button(root, text="Submit", command=submit)
submit.grid(row=3, column=0, columnspan=2, sticky=tk.NSEW)

# Start the mainloop like in Tkinter
root.mainloop()

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

TkZero-0.0.6.tar.gz (135.1 kB view hashes)

Uploaded Source

Built Distribution

TkZero-0.0.6-py3-none-any.whl (49.8 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