Python - tkinter animation - coding for all

Published: 08 December 2020
on channel: Jithesh Kuyyalil
527
6

https://jitheshkuyyalil.com



Animating tkinter label in Python.
Ref: Programming Python by Mark Lutz

Source Code

import random
from tkinter import *
fsize = 20
colors=('red', 'green', 'orange','grey', 'cyan', 'blue', 'violet')


def makePopUp():
pop=Toplevel()
lb=Label(pop, text='new popup')
color = fg=random.choice(colors)
lb.config(font=('aerial', fsize, 'italic'), fg=color)
lb.pack(fill=BOTH)
rootLabel.config(fg=color)

def changeColor():
rootLabel.config(fg=random.choice(colors))
win.after(100, changeColor)

def blowUp():
global fsize
fsize += 5
rootLabel.config(font=('arial', fsize, 'italic'))
win.after(250, blowUp)


win = Tk()
rootLabel = Label(win, text="Gui Animation")
rootLabel.config(font=('aerial', fsize, 'italic'), \
fg="#%02x%02x%02x" % (255, 0, 0), bg='papaya whip')
rootLabel.pack(side=TOP, expand=True, fill=BOTH)
Button(win, text='make popup', command=makePopUp).pack(fill=X)
Button(win, text='change color', command=changeColor).pack(fill=X)
Button(win, text='blow up', command=blowUp).pack(fill=X)
win.mainloop()


On this page of the site you can watch the video online Python - tkinter animation - coding for all with a duration of hours minute second in good quality, which was uploaded by the user Jithesh Kuyyalil 08 December 2020, share the link with friends and acquaintances, this video has already been watched 527 times on youtube and it was liked by 6 viewers. Enjoy your viewing!