Skip to main content

Multi-Function Helper, for GUI, Basic file functions, arguments checks and a new advanced feature called Prefix(str)

Project description

multihelper

Multi-Function Helper for GUI, basic file functions, argument checks, and the advanced prefix() feature.

Installation

pip install multihelper

For Kivy GUI support:

pip install multihelper[kivy]

Usage

from multihelper import Task, GUI, prefix
from multihelper import ArgumentNotGivenError, PrefixFunctionMismatchError, WrongArgumentError

Task

Basic file and utility functions.

Task.wait(2)                                      # sleep 2 seconds
Task.FileExists("file.txt")                       # prints result, sets Task.SuccessFileExistsCode
Task.ReadFromFile("file.txt")                     # returns file contents as string
Task.WriteToFile("file.txt", data="hello")        # appends to file
Task.OverWriteToFile("file.txt", data="hello")    # overwrites file
Task.CheckArg("--run")                            # checks sys.argv for string
Task.CheckArg("--run", tell=True)                 # verbose argument listing
Task.ExitWithoutDynamicErrors("bye")              # clean SystemExit
Task.ExitWithoutDynamicErrors("bye", verbose=True)

prefix()

Injects all functions from a module into the calling file's global namespace, removing the need for the module prefix.

prefix("os")
cwd = getcwd()      # instead of os.getcwd()
files = listdir(".") # instead of os.listdir(".")

WrongArgumentError

Raised when a type-annotated prefixed function receives the wrong type or wrong number of arguments.

WrongArgumentError: wrong type for argument 'n' in 'sleep'.
  Expected: int
  Got:      str ('hello')

PrefixFunctionMismatchError

Raised lazily when a prefixed function name collides with a user-defined function in the same file. Raised on call, prints all collisions, then SystemExit.

def sleep(n):       # collides with time.sleep after prefix("time")
    pass

prefix("time")
sleep(1)            # raises PrefixFunctionMismatchError here

GUI

GUI.Tkinter

from multihelper import GUI

def on_click():
    print("clicked!")

GUI.Tkinter.WindowInit("My App", 800, 600)
GUI.Tkinter.Label("Hello!", 100, 50)
GUI.Tkinter.Button("Click Me", 100, 120, on_click)
inp = GUI.Tkinter.Input(100, 180)
GUI.Tkinter.Gravity("center")
GUI.Tkinter.Run()

No .pack(), .grid(), .place(), or .mainloop() ever written manually.

Gravity directions: center, top, bottom, left, right

GUI.Kivy

Requires pip install multihelper[kivy]

GUI.Kivy.WindowInit("My App", 800, 600)
GUI.Kivy.Label("Hello!", 100, 200)
GUI.Kivy.Button("Click Me", 100, 120, on_click)
GUI.Kivy.Input(100, 60)
GUI.Kivy.Run()

Exceptions

Exception When
ArgumentNotGivenError Raise manually when a required argument is missing
PrefixFunctionMismatchError Name collision between prefixed module function and user-defined function
WrongArgumentError Wrong type or count passed to a type-annotated prefixed function

License

GPLv3 — Copyright (C) 2026 Alan

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

multihelper-1.0.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

multihelper-1.0.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file multihelper-1.0.0.tar.gz.

File metadata

  • Download URL: multihelper-1.0.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for multihelper-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c101135ec593e5931ea42b751bf3b036523f9646e2ca163b7c71701530ab76a4
MD5 d50a209ee0f8e5d601de34f969cbea2c
BLAKE2b-256 1f0105a286025c4a5c12e5239c63887559e1363e10313b52d9d64f12e3097cca

See more details on using hashes here.

File details

Details for the file multihelper-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: multihelper-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for multihelper-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 136d6b82b8a09c81d934f12bcf9491cad72e80c2ad0c68ef3c1bab46ea0031a6
MD5 a6fac768ac01c97de0f2ceed695be79b
BLAKE2b-256 7f09fb5b726988d8919f5f7d80d95a388c953ddb7a11a9c8a24307b7e8744f61

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