A Tkinter animation library with 10 reusable animations.
Project description
TkAnimations
⚠️ WARNING: This library is still under development and may contain bugs.
If you encounter any issues, please report them. Contributions are welcome!
TkAnimations is a collection of reusable animation effects for Tkinter widgets, designed to bring life and motion to your desktop apps — all from a single, lightweight Python file.
✨ Features
- Fade in/out effects
- Slide animations in all directions
- Bouncing effects
- Pulsing effects
- Wiggle effects
- Color transitions
- Expand/shrink animations
- Shake effects
- Hover animations
📦 Installation
Simply copy the tk_animations.py file into your project folder.
🚀 Basic Usage
from tkinter import *
from tk_animations import TkAnimations
root = Tk()
animations = TkAnimations()
# Apply to any widget
button = Button(root, text="Click me")
button.pack()
animations.animate_fade_in(button)
🧩 Complete Method Reference
🔹 Fade Effects
animate_fade_in(
widget: tk.Widget,
duration: int = 1000,
callback: Optional[Callable] = None
)
animate_fade_out(
widget: tk.Widget,
duration: int = 1000,
callback: Optional[Callable] = None
)
🔹 Movement Animations
animate_slide(
widget: tk.Widget,
direction: str = 'right', # 'left'/'right'/'up'/'down'
distance: int = 100,
duration: int = 1000,
callback: Optional[Callable] = None
)
animate_bounce(
widget: tk.Widget,
height: int = 30, # Max bounce height
bounces: int = 3,
duration: int = 1500,
callback: Optional[Callable] = None
)
animate_hover(
widget: tk.Widget,
hover_lift: int = 10, # Lift distance
duration: int = 300,
callback: Optional[Callable] = None
)
🔹 Transformation Effects
animate_pulse(
widget: tk.Widget,
scale_factor: float = 1.2, # Max scale
pulses: int = 3,
duration: int = 1000,
callback: Optional[Callable] = None
)
animate_wiggle(
widget: tk.Widget,
angle: float = 10.0, # Max rotation
wiggles: int = 5,
duration: int = 1000,
callback: Optional[Callable] = None
)
animate_expand_shrink(
widget: tk.Widget,
expand_factor: float = 1.5,
duration: int = 1000,
shrink_back: bool = True, # Return to original size
callback: Optional[Callable] = None
)
🔹 Visual Effects
animate_color_transition(
widget: tk.Widget,
start_color: str = '#FFFFFF',
end_color: str = '#3498db',
duration: int = 1000,
property_name: str = 'bg', # 'fg' for text color
callback: Optional[Callable] = None
)
animate_shake(
widget: tk.Widget,
intensity: int = 10, # Shake strength
shakes: int = 5,
duration: int = 800,
callback: Optional[Callable] = None
)
🧪 Demo Application
The library includes a ready-to-run demo:
if __name__ == "__main__":
demo_app() # Shows all animations
📝 Important Notes
Geometry Managers:
- Works best with
place()manager for precise control.
Performance:
- Complex animations may affect performance on older hardware.
- Alpha effects may not work on all platforms.
Duration:
- All durations are in milliseconds (1000ms = 1s).
Callbacks:
- Optional callback functions execute after animation completes.
🪪 License
MIT License — Free to use, modify and distribute.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tk_animations-0.1.0.tar.gz.
File metadata
- Download URL: tk_animations-0.1.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04ab919845b0dc8a46152208047ffc39fcea15282f9eb40055cb7c9d5044d94a
|
|
| MD5 |
e4e47c815d4809feae0706d4046e4901
|
|
| BLAKE2b-256 |
d350685298b496ccf5826ab7b2292e7a8c20c4cb620fb1685846c163ab1b60b3
|
File details
Details for the file tk_animations-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tk_animations-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
699dc9e2aa5874f951f6112146e59a66bc870340fe903ba156f5f33fa2aae4ae
|
|
| MD5 |
a2ccea4a7cbd061a4a825b2eafaab8c2
|
|
| BLAKE2b-256 |
1919fdaa88d246d3011b8956e0c1d7e88e774b1f9c27eb155501cd82d82c90e3
|