Skip to main content

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_0
  • button_1
  • entry_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 label
  • label_number (int): Row index and unique ID
  • fg (str): Text color
  • bg (str): Background color
  • label_width (int): Width of label
  • label_height (int): Height of label

Conditions

  • label_number must be unique

Returns

  • tk.Label object

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 text
  • button_number (int): Row index and ID
  • button_command (callable): Function executed on click
  • fg (str): Text color
  • bg (str): Background color
  • button_width (int): Width
  • button_height (int): Height

Conditions

  • button_command must be a function or None

Returns

  • tk.Button object

3. make_entry

def make_entry(self, entry_number=0, entry_width=30,
               fg="black", bg="white"):

Parameters

  • entry_number (int): Row index and ID
  • entry_width (int): Width of entry
  • fg (str): Text color
  • bg (str): Background color

Returns

  • tk.Entry object

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

  • ValueError if entry does not exist
  • TypeError if widget is not an Entry

Returns

  • str

5. delete_widget

def delete_widget(self, widget_number, widget_type):

Parameters

  • widget_number (int): Widget ID
  • widget_type (str): label, button, or entry

Conditions

  • Widget must exist in dictionary

Errors

  • ValueError if 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

hutk-1.0.2.tar.gz (4.5 kB view details)

Uploaded Source

File details

Details for the file hutk-1.0.2.tar.gz.

File metadata

  • Download URL: hutk-1.0.2.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

Hashes for hutk-1.0.2.tar.gz
Algorithm Hash digest
SHA256 62345e0bccc5e9ded33f84794c45f760077a44018bcd186793923a474beb977b
MD5 63481d71c9d5ab8cd48fade0a70ae8cb
BLAKE2b-256 d49cc3d0f5c9dfadab3e7607d007c368798320ac0ab66172ade5a01c226a571d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page