Skip to main content

PyTkAnim is extension for tkinter that provides animator and simple usage.

Project description

PyTkAnim is extension for tkinter that provides animator and simple usage.

Note:This package is under construction and many style of animations soon! for now you can only animate X,Y,Width and Height

The advantages of this packages is

  • Don't need to call .pack()
  • Easy to understand

Changes 1.0.2

  • added EaseInSine functions for X and Y (Width and Height Coming Soon!).
  • a little bit of adjustments.

animate Y when button is clicked

import tkinter as tk
from pytkanim import CustomAnimations

root = tk.Tk() 
                                   #Widget Name    can be also 'up'
Label = CustomAnimations.NormalAnimY(tk.Label(bg="Black"),"down") 
Button = tk.Button(text="Click Me",command=Label.run)
Button.pack()

root.geometry("800x600")
root.mainloop()

animate X when button is clicked

import tkinter as tk
from pytkanim import CustomAnimations

root = tk.Tk()
                                  #Widget Name    can be also 'backwards'
Label = CustomAnimations.NormalAnimX(tk.Label(bg="Black"),"forward") 
Button = tk.Button(text="Click Me",command=Label.run)
Button.pack()

root.geometry("800x600")
root.mainloop()

You can add starter X and Y positions too! by simple doing this

import tkinter as tk
from pytkanim import CustomAnimations

root = tk.Tk()

Label = CustomAnimations.NormalAnimX(tk.Label(bg="Black"),"backwards",startAX=0.5,startAY=0.5)
Button = tk.Button(text="Click Me",command=Label.run)
Button.pack()

root.geometry("800x600")
root.mainloop()

and also how speed to animate is.

import tkinter as tk
from pytkanim import CustomAnimations

root = tk.Tk()

Label = CustomAnimations.NormalAnimX(tk.Label(bg="Black"),"forward",startAX=0.5,startAY=0.5,speed=10) #Higher amount of speed the more it goes slower
Button = tk.Button(text="Click Me",command=Label.run)
Button.pack()

root.geometry("800x600")
root.mainloop()

Stop and Continue Animation

import tkinter as tk
from pytkanim import CustomAnimations
stopped = False
root = tk.Tk()

Label = CustomAnimations.NormalAnimX(tk.Label(bg="Black"),"forward",startAX=0,startAY=0.5,speed=10)
Label.run()

def continueAndStop():
    global stopped,Label
    if stopped == False:
        stopped = True
        Label.stop()
    else:
        stopped = False
        Label.continueAnim()


Button = tk.Button(text="Stop/Continue",command=continueAndStop)
Button.pack()

root.geometry("800x600")
root.mainloop()

Changing Direction

import tkinter as tk
from pytkanim import CustomAnimations
directionChanged = True
root = tk.Tk()

Label = CustomAnimations.NormalAnimX(tk.Label(bg="Black"),"forward",startAX=0,startAY=0.5,speed=10)
Label.run()

def changingDirection():
    global directionChanged,Label
    if directionChanged == False:
        directionChanged = True
        Label.changeDirection("forward")
    else:
        directionChanged = False
        Label.changeDirection("backwards")


Button = tk.Button(text="Click to Change Direction",command=changingDirection)
Button.pack()

root.geometry("800x600")
root.mainloop()

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

PyTkAnim-1.0.2.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

PyTkAnim-1.0.2-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: PyTkAnim-1.0.2.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.7

File hashes

Hashes for PyTkAnim-1.0.2.tar.gz
Algorithm Hash digest
SHA256 0ed16863698597811e57cef7e6057490916029453711b8fa126326d92dff4fe3
MD5 93fe79d4b67fcd4b1058294e5b074d79
BLAKE2b-256 7c7423585f51d7c8a3692aa252547380d9d0fd717aa9d464392cb2833797012b

See more details on using hashes here.

File details

Details for the file PyTkAnim-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: PyTkAnim-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.7

File hashes

Hashes for PyTkAnim-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fc402211b00d01208fbcb54ec8ace9b8261f087577f94c745a2b3450fa29c528
MD5 524c681816c68bd15795360b8002dced
BLAKE2b-256 3c2a7f6a263bd400d35f4079ef2e4020a414df32bd5785ba0d134c0e3a15b889

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