Tkinter functionality
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
TkinterMaster-1.0.0.tar.gz
(3.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file TkinterMaster-1.0.0.tar.gz.
File metadata
- Download URL: TkinterMaster-1.0.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
630463373ad3f3b93c1f9606900d5df8d5b28ad984fdaf1bd3aa29b231de3d43
|
|
| MD5 |
7d34bc39e587f2bf4bb343dea8012ef8
|
|
| BLAKE2b-256 |
3392c9d563adc84575949064fab12a83f1b6837db13b51a3ffc8aa9f186b9e4f
|
File details
Details for the file TkinterMaster-1.0.0-py3-none-any.whl.
File metadata
- Download URL: TkinterMaster-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5828240c351feada79ffae1ae5a2b96221b133570165ca671179f3a1368eb888
|
|
| MD5 |
f72998b99b4b1e1a6bd05f409a320855
|
|
| BLAKE2b-256 |
d3babff4519ca5d38f0b0c54aaa8625d1765d80e7c63de681d9a3dccd915d64d
|