Skip to main content

tkinterx

GitHub issues GitHub forks GitHub stars GitHub license HitCount PyPI - Python Version repo size contributors watcher

Use tkinter to create a handy GUI tool.

PyPI support available

You can install the latest version using the following command:

pip install tkinterx

The following command is used when called:

import tkinterx

A sample: Record your personal information

class Window(WindowMeta):
    def __init__(self, master=None, cnf={}, **kw):
        super().__init__(master, cnf, **kw)

    def create_widget(self):
        self.add_row('Please enter your name:', 'name')
        self.add_row('Please enter your age:', 'age')
        self.add_row('Enter your information saving path:', 'save_path')

    def save(self, path):
        table = self.table.todict()
        with open(path, 'w') as fp:
            json.dump(table, fp)

    def run(self):
        self.withdraw()
        name = self.table['name']
        age = self.table['age']
        save_path = str(self.table['save_path'])
        if '' in [name, age, save_path]:
            showwarning(self)
        else:
            self.save(save_path)
            askokcancel(self)


class Root(Tk):
    def __init__(self):
        super().__init__()
        self.label_var = StringVar()
        self.create_widgets()
        self.layout()

    def create_buttons(self):
        style = ttk.Style()
        style.configure("C.TButton",
                        foreground="green",
                        background="white",
                        relief='raise',
                        justify='center',
                        font=('YaHei', '10', 'bold'))
        self.table_button = ttk.Button(self, text='Fill in your name and age:',
                                       command=self.ask_table,
                                       style="C.TButton")

    def create_widgets(self):
        self.create_buttons()
        self.label = ttk.Label(self, textvariable=self.label_var)

    def ask_table(self):
        bunch = ask_window(self, Window)
        name, age = bunch['name'], bunch['age']
        self.label_var.set(f"{name}: {age}")

    def layout(self):
        self.table_button.pack()
        self.label.pack()


if __name__ == "__main__":
    root = Root()
    root.geometry('300x200')
    root.mainloop()

Interface presentation:

Figure 1: record your personal information

For more information: Chinese Manual.

Release files for tkinterx 0.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tkinterx 0.0.9
File Size Uploaded
tkinterx-0.0.9.tar.gz 18.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tkinterx 0.0.9
File Interpreter ABI Platform
tkinterx-0.0.9-py3-none-any.whl Python 3 none any Details

Total release size: 48.9 kB

Release files / tkinterx-0.0.9.tar.gz

Download URL tkinterx-0.0.9.tar.gz
Size 18.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a826793d261aa23649eb78458a7ffb57017877b0fc84f81b3a134e145074ecb1
BLAKE2b-256 checksum
How to use checksums
50ab44a6d70b1b7d87ad12adceba72c0ae6fb9f4a860550117072fbe8caa5538
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

Release files / tkinterx-0.0.9-py3-none-any.whl

Download URL tkinterx-0.0.9-py3-none-any.whl
Size 30.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
50fd2841d9044b280fe5bda5df8c13b4d95e51cdf378a9e3afa6a523f31a0ca5
BLAKE2b-256 checksum
How to use checksums
fe6608c3cad71531c5146ede52e2da338f512ce373a4464292c8ca7150ffd386
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

Release history Release notifications | RSS feed

This release

0.0.9 This release

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page