Skip to main content

A comprehensive multilingual GUI extension library for Tkinter with enhanced message boxes, and Windows-specific features

Project description

Tkface

License: MIT PyPI - Python Version GitHub Release PyPi Version Downloads

Restore the "face" to your Tkinter!

A multilingual GUI extension library for Tkinter (tkinter) - bringing back the "face" (interface) that Tkinter left behind.


📖 Overview

Tkface is a Python library designed to restore and enhance the "face" (user interface) of Tkinter. While Tkinter is a powerful toolkit, its dialogs and user-facing components are minimal and lack friendly interfaces. Tkface fills this gap with multilingual dialogs, advanced message boxes, and Windows-specific features.

  • Completing the Interface: Tkinter stands for "Tk interface," providing a powerful core for building GUIs. Tkface is designed to complement it by providing the user-facing components—the "face"—that are essential for a polished user experience but not built into the standard library. It extends Tkinter with ready-to-use, multilingual dialogs and widgets, letting you build sophisticated, user-friendly applications with less effort.
  • Vibe Coding: Developed with a "Vibe Coding" approach-prioritizing developer joy, rapid prototyping, and a sense of fun. The codebase is hackable, readable, and easy to extend—and so is this document.

🔧 Requirements

  • Python 3.7+
  • Tkinter (included with Python)
  • No additional dependencies

📦 Installation

Install the latest version from PyPI:

pip install tkface

Or install from the GitHub repository for the latest changes:

pip install git+https://github.com/mashu3/tkface.git

🚀 Usage

Message Boxes

from tkface import messagebox

# Simple information dialog
messagebox.showinfo("Success", "Operation completed successfully!")

# Multilingual support
messagebox.showerror("Error", "An error has occurred!", language="ja")

# With system sound (Windows only)
messagebox.showerror("Error", "An error has occurred!", bell=True)

# Confirmation dialog
if messagebox.askyesno("Confirm", "Do you want to save?"):
    save_file()

Screenshots

Dialog Type Windows Environment
Warning Warning Dialog
Error Error Dialog
Information Info Dialog
Question Question Dialog

Input Dialogs

from tkface import simpledialog

# String input
name = simpledialog.askstring("Name", "Enter your name:")

# Integer input with validation
age = simpledialog.askinteger("Age", "Enter your age:", minvalue=0, maxvalue=120)

Windows-Specific Features

import tkinter as tk
import tkface

root = tk.Tk()
tkface.win.dpi()         # Enable DPI awareness (Windows only)
tkface.win.unround(root) # Disable corner rounding (Windows 11 only)
tkface.win.bell("error") # Play Windows system sound (Windows only)

# Windows-specific flat button styling
button = tkface.Button(root, text="Flat Button", command=callback)  # No shadow on Windows
root.mainloop()

Note: All Windows-specific features gracefully degrade on non-Windows platforms.

Language Management

from tkface import lang
import tkinter as tk

root = tk.Tk()
lang.set("ja", root)  # Set language manually
lang.set("auto", root)  # Auto-detect system language

# Register custom translations
custom_translations = {
    "ja": {
        "Custom Message": "カスタムメッセージ",
        "Custom Button": "カスタムボタン"
    }
}
from tkface import messagebox
messagebox.showinfo(
    "Custom Message",
    "This will be translated",
    custom_translations=custom_translations,
    language="ja"
)

🧩 Features

  • Multilingual Support: Automatic language detection, English/Japanese built-in, custom dictionaries
  • Enhanced Message Boxes: All standard and advanced dialogs, custom positioning, keyboard shortcuts, tab navigation
  • Enhanced Input Dialogs: String/integer/float input, validation, password input, custom positioning
  • Windows Features: DPI awareness, Windows 11 corner rounding control, Windows system sounds, flat button styling (gracefully degrade on other OS)

📁 Examples

See the examples/ directory for complete working examples:

  • demo_messagebox.py - Message box demonstrations
  • demo_simpledialog.py - Input dialog demonstrations

Note: Test files are not included in the public release. For testing, see the development repository.


🌐 Supported Languages

  • English (en): Default, comprehensive translations
  • Japanese (ja): Complete Japanese translations

You can add support for any language by providing translation dictionaries:

custom_translations = {
    "fr": {
        "ok": "OK",
        "cancel": "Annuler",
        "yes": "Oui",
        "no": "Non",
        "Error": "Erreur",
        "Warning": "Avertissement"
    }
}

📝 License

This project is licensed under the MIT License. See the LICENSE file for details.


👨‍💻 Author

mashu3

Authors

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

tkface-0.0.3.tar.gz (22.1 kB view details)

Uploaded Source

Built Distribution

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

tkface-0.0.3-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

File details

Details for the file tkface-0.0.3.tar.gz.

File metadata

  • Download URL: tkface-0.0.3.tar.gz
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for tkface-0.0.3.tar.gz
Algorithm Hash digest
SHA256 1ee9f94279f7b45818ff1f7b006b8aabdfe2baf09387b78bd993a045f5e9c29c
MD5 d5c7358cab236fe48c755760948da733
BLAKE2b-256 b29dd0564550132352fd090707a1d5013dd72336ba3e600e0a70f17da376c8f3

See more details on using hashes here.

File details

Details for the file tkface-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: tkface-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 22.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for tkface-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 826653a8211dfe6e4b8cf08d096a8905b8bf9059daf41865599aabbb483305b9
MD5 cc89cd964b28bfbb4fdfd9ae9f0c2b08
BLAKE2b-256 46ca3194d6d02cf2268b0a50abcf8ed9381347616536c9bfd0fc6eab6aece9ca

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