How To Animate Widgets - Python Tkinter GUI Tutorial #164

preview_player
Показать описание
In this video I'll show you how to Animate Widgets with Tkinter and Python.

Tkinter doesn't come with a built in animation function, instead we're going to have to hack together a solution using the .after() function and a series of counters and .config() functions.

We can also move the position of a widget by using the .pack_configure() or .grid_configure() functions.

Tkinter canvas allows you to move things fairly easily, but for regular widgets; this method gets the job done!
Рекомендации по теме
Комментарии
Автор

▶️ Watch Entire Tkinter Playlist ✅ Subscribe To My YouTube Channel:
▶️ See More At: ✅ Join My Facebook Group:
▶️ Get The Code

Codemycom
Автор

I love that I'm forced to watch 3 minutes of unskippable ads to watch this video. Very engaging. EDIT after watching for a bit: Great content, love the cadence.

brandonmulas
Автор

Good, very good. Im very happy to use it ;)

gtasaw
Автор

I will surely use this on my next project.

mypegionworld
Автор

I just found your channel and this helps me alot in exploring Python more.

rahuljangid
Автор

Great Video! Love from India!!! Can you give me a heart? 😀

jenilchudgar
Автор

thank you ! that's exactly what i was looking for

DewasSquid
Автор

Thank you! I am learning to code in python by building a yahtzee game. I just used this trick to flash through a bunch of dice pictures when the roll button is clicked so it looks like the dice are rolling.

How is it that everytime I have a "can I do what I'm thinking right now?" You have an entire video dedicated to my exact question? Your channel is amazing.

markm
Автор

please, can you do a video on three screens? for example the widgets on maximized appear in a different way of the half of the screen and on the small screens

ramehharmouch
Автор

is it possible to configure a widget if you used place instead of pack? i tried using place_config instead of pack_config like you used in the video but it didn't work :/

markm
Автор

Hey thanks for the video but, im not able to do it with an image in canvas.

halflight
Автор

how can i make a entry and while it is clear it set 'enter name' and if someone types anything in it it will set what he typed, like websites ??

محمودعبدالرحمن-قه
Автор

Thank you so much !
The button has a command to change the font: but is it possible to add another command to this button (threading?)?

laurentreynaud
Автор

Could you use .place() in the command function to iteratively move the button as well?

snp
Автор

your video has really helped me a lot in python, is there any certification exam for it to get a job or you just have to know it alone

omolarasilverstone
Автор

Your video are aswemo watching your tkinter playlist but how did you make title bar dark??

adarshraj
Автор

Can you please do a video on fetching bulk images (BLOB) from the SQLite database and displaying them on the GUI window?

anuragrawat
Автор

Sir pls help me to make real time audio in progress bar with python

AnandKumar-bjux
Автор

chiqargan funksiyezi pasroqqa olib qoyorasimi codi corinmayapti

ilyosbeksharobiddinov
Автор

I'm a noob, but isn't this a little more useful ...? (I hate globals as I come from a time when memory management and non-local/static were frowned up)

Fewer functions (if you omit my main()) and the easy ability to call another ''real command on the button (I didn't worry about moving around the button .. you can whack that in ...)


def main():
animateButtton

def animateButtton():
root = Tk()
root.geometry('400x300')
passedVal = ''
btn = Button(root, text='Click Me', font=('Helvetica', 24), command = lambda : animate(btn, 'Inside the Real Command'))
btn.pack(pady=50)
root.mainloop

def animate(btn, passedVal):
size = 24
for count in range(1, 10):
size += 2
btn.configure(font=('Helvetica', size))
btn.update()
time.sleep(.025)

for count in range(10, 1, -1):
size -= 2
btn.configure(font=('Helvetica', size))
btn.update()
time.sleep(.025)

x = doRealFunction(passedVal)



def doRealFunction(val):
frmMain = Toplevel()
frmMain.geometry('300x100')

Label(frmMain, text = 'Real function - > incoming parm :\n' + val).pack(pady=20)
frmMain.mainloop()

if __name__ == __main__:
main()

anthonycaulfield
visit shbcf.ru