Skip to main content

TkinterMasterPy

TkinterMasterPy is a Python library that simplifies the creation of graphical user interfaces (GUIs) using the Tkinter library. It provides easy-to-use methods for adding common GUI elements and styling options.

Installation

You can install TkinterMasterPy using pip:

pip install TkinterMasterPy

Usage

from TkinterMaster import TkinterMaster

Initialize the TkinterMaster

my_app = TkinterMaster("My App", "600x400")

Run the Application

my_app.run()

Create a Notebook

my_app.notebook()

Add a Label

my_app.add_label(parent, text="Hello, Tkinter!", grid={"row": 1, "column": 1})

Add a Button

my_app.add_button(
    parent,
    text="Click Me",
    command=my_function,
    grid={"row": 2, "column": 1}
)

Add an Entry

entry_var = StringVar()
my_app.add_entry(
    parent,
    grid={"row": 3, "column": 1},
    entry={"textvariable": entry_var, "show": "*"}
)

Add a Text Widget

my_app.add_text(parent, width=40, height=10, grid={"row": 1, "column": 1})

Add a Listbox

items = ["Item 1", "Item 2", "Item 3"]
my_app.add_listbox(parent, items, grid={"row": 2, "column": 1})

Add a Frame

my_app.add_frame(parent, grid={"row": 3, "column": 1})

Add a Combobox

values = ["Option 1", "Option 2", "Option 3"]
my_app.add_combobox(parent, values, grid={"row": 4, "column": 1})

Add a Radiobutton

variable = IntVar()
my_app.add_radiobutton(
    parent,
    text="Option 1",
    variable=variable,
    value=1,
    grid={"row": 5, "column": 1}
)

Add a Checkbox

checkbox_var = BooleanVar()
my_app.add_checkbox(
    parent,
    text="Check me",
    variable=checkbox_var,
    grid={"row": 6, "column": 1}
)

Styling

Configure Style

my_app.configure_style("TLabel", {"background": "#3498db", "foreground": "#ffffff"})

Example usage

from tkinter import StringVar, ttk
from TkinterMaster import TkinterMaster


class MyApp(TkinterMaster):
    def __init__(self):
        super().__init__("Mi App", "600x400")

    def create_interface(self):
        self.notebook()
        tab1 = self.add_frame(self.notebook, for_notebook=True)
        tab2 = self.add_frame(self.notebook, for_notebook=True)
        self.notebook.add(tab1, text="Tab 1")
        self.notebook.add(tab2, text="Tab 2")

        self.add_label(tab1, text="¡Hola, Tkinter!", grid={"row": 1, "column": 1})

        self.add_button(
            tab1,
            text="Haz clic",
            command=self.button_click,
            grid={"row": 2, "column": 1},
        )

        entry_var = StringVar()
        self.add_entry(
            tab1,
            grid={"row": 3, "column": 1},
            entry={"textvariable": entry_var, "show": "*"},
        )

        self.add_text(tab2, width=40, height=10, grid={"row": 1, "column": 1})

        items = ["Item 1", "Item 2", "Item 3"]
        self.add_listbox(tab2, items, grid={"row": 2, "column": 1})

    def button_click(self):
        print("Botón clickeado!")


if __name__ == "__main__":
    my_app = MyApp()
    my_app.create_interface()
    my_app.run()

License

TkinterMaster is licensed under the MIT.

Metadata

Release files for TkinterMaster 1.0.0

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

Source distribution (sdist)

Source distribution for TkinterMaster 1.0.0
File Size Uploaded
TkinterMaster-1.0.0.tar.gz 3.5 kB Details

Built distribution (wheel)

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

Total release size: 7.0 kB

Release files / TkinterMaster-1.0.0.tar.gz

Download URL TkinterMaster-1.0.0.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
630463373ad3f3b93c1f9606900d5df8d5b28ad984fdaf1bd3aa29b231de3d43
BLAKE2b-256 checksum
How to use checksums
3392c9d563adc84575949064fab12a83f1b6837db13b51a3ffc8aa9f186b9e4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / TkinterMaster-1.0.0-py3-none-any.whl

Download URL TkinterMaster-1.0.0-py3-none-any.whl
Size 3.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5828240c351feada79ffae1ae5a2b96221b133570165ca671179f3a1368eb888
BLAKE2b-256 checksum
How to use checksums
d3babff4519ca5d38f0b0c54aaa8625d1765d80e7c63de681d9a3dccd915d64d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release history Release notifications | RSS feed

This release

1.0.0 This release

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