Skip to content

Tkinter based package for sending GUI alerts / notifications.

License

Notifications You must be signed in to change notification settings

DragosPancescu/tk-alert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python License: MIT PyPI - Downloads

tk-alert

Lightweight, self-contained package for sending GUI alerts using tkinter.

Table of Contents

  1. Introduction
  2. Features
  3. Usage
  4. Roadmap Items
  5. License

Features

🚀 Minimal setup for sending GUI alerts in a Tkinter app

🎨 Highly customizable Alert widget with a modern design by default

🛠️ Ease of use out-of-the-box

Usage

This example demonstrates how to create a basic Tkinter window and utilize the tk-alert library to display an alert notification when a button is clicked.

1. Setup

First, install the library using pip:

pip install tk-alert

2. Example Code

import tkinter as tk
import tk_alert as tk_a

if __name__ == "__main__":
    app = tk.Tk()
    app.geometry("800x800")

    alert_generator = tk_a.AlertGenerator(app)

    show_notification_btn = tk.Button(app)
    show_notification_btn.configure(
        text="Send Alert",
        command=lambda: alert_generator.send(
            text="Alert information: Lorem Ipsum Dolor Sit Amet",
            type=tk_a.AlertType.INFO,
            anchor=tk.NW,
            duration=5
        ),
    )
    show_notification_btn.pack()

    app.mainloop()

3. Default Alert Design

Roadmap Items

This package is a work in progress. Below is the roadmap for the upcoming developments I wish to implement:

  • Tooltip on Hover: Whenever the text inside the alert is truncated, a tooltip should appear on hover.
  • Support for Multiple Python 3 Versions: Extend compatibility to support multiple versions of Python 3.
  • Tests: Implement testing to ensure code reliability.
  • Configuration System for the AlertGenerator Class: Develop a configuration system where a config object can be created and injected into the class. This will eliminate the need to pass configurations at runtime every time the .send() method is called.
  • Better Icon Support: Enhance icon support, allowing users to change icons rather than relying on predefined options.
  • Minimum Width Constraint: Implement a feature to constrain the alert with a min_width argument.
  • Animations: Implement an animation system.

License

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