A module for new programers or allameh helli school
Project description
HumblyTkinter Library Documentation
Library name: humblytkinter Author: Mohammad Parsa Abdi (محمدپارسا عبدی)
Introduction
humblytkinter is a simple Python library built on top of the standard tkinter module. The goal of this library is to make GUI creation easier and cleaner for beginners by providing ready-to-use methods for common widgets such as labels, buttons, and entries.
This documentation explains all classes, functions, parameters, conditions, and usage rules of the library in detail.
All code examples are written in English, Left-to-Right (LTR), and are safe to copy and use directly.
Installation
Place the humblytkinter folder in your project or install it locally, then import it:
from humblytkinter import MyGUI
Main Class
MyGUI
This is the core class of the library. It manages the window, widgets, and execution of the GUI.
class MyGUI:
Constructor
def __init__(self, window_name="My Window"):
Parameters
window_name(str): The title of the application window.
What it does
- Creates the main Tkinter window
- Sets the window title
- Initializes an internal dictionary to track widgets
Widgets Storage System
The library stores all widgets in a dictionary:
self.widgets = {}
Each widget is saved with a unique key such as:
label_0button_1entry_2
This allows safe deletion, access, and validation.
Functions (Methods)
1. make_label
def make_label(self, label_text="Hello World", label_number=0,
fg="black", bg="white", label_width=30, label_height=2):
Parameters
label_text(str): Text shown on the labellabel_number(int): Row index and unique IDfg(str): Text colorbg(str): Background colorlabel_width(int): Width of labellabel_height(int): Height of label
Conditions
label_numbermust be unique
Returns
tk.Labelobject
2. make_button
def make_button(self, button_text="Click", button_number=0,
button_command=None, fg="black", bg="lightgray",
button_width=30, button_height=2):
Parameters
button_text(str): Button textbutton_number(int): Row index and IDbutton_command(callable): Function executed on clickfg(str): Text colorbg(str): Background colorbutton_width(int): Widthbutton_height(int): Height
Conditions
button_commandmust be a function orNone
Returns
tk.Buttonobject
3. make_entry
def make_entry(self, entry_number=0, entry_width=30,
fg="black", bg="white"):
Parameters
entry_number(int): Row index and IDentry_width(int): Width of entryfg(str): Text colorbg(str): Background color
Returns
tk.Entryobject
4. get_output
def get_output(self, entry_number=0):
What it does
- Retrieves text from a specific Entry widget
Conditions
- Entry must exist
- Widget must be of type
tk.Entry
Errors
ValueErrorif entry does not existTypeErrorif widget is not an Entry
Returns
str
5. delete_widget
def delete_widget(self, widget_number, widget_type):
Parameters
widget_number(int): Widget IDwidget_type(str):label,button, orentry
Conditions
- Widget must exist in dictionary
Errors
ValueErrorif widget not found
6. delete_all
def delete_all(self):
What it does
- Destroys all widgets
- Clears widget storage
7. run
def run(self):
What it does
- Starts the Tkinter main loop
- Keeps the window running
Full Example
from humblytkinter import MyGUI
def show_text():
text = app.get_output(0)
print(text)
app = MyGUI("HumblyTkinter Demo")
app.make_label("Enter your name", 0)
app.make_entry(1)
app.make_button("Submit", 2, show_text)
app.run()
Design Goals
- Beginner-friendly
- Minimal syntax
- Clean structure
- Safe widget management
License & Credits
Created by Mohammad Parsa Abdi Library name: humblytkinter
You are free to use and modify this library for educational projects.
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
File details
Details for the file hutk-1.0.3.tar.gz.
File metadata
- Download URL: hutk-1.0.3.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2505d62b573a90eb308303d7a36afa4ebf8c5f69098a6ef347b32110ab7de8e3
|
|
| MD5 |
4986de16cdf6de3b5916eda56a052f08
|
|
| BLAKE2b-256 |
717933d8b10047652a75f0306558ac80508b5473d33c755b9232f5da70a3bf3e
|