Learn Python animations 🛸

  Рет қаралды 50,629

Bro Code

Bro Code

Күн бұрын

Пікірлер: 73
@BroCodez
@BroCodez 4 жыл бұрын
from tkinter import * import time WIDTH = 500 HEIGHT = 500 xVelocity = 1 yVelocity = 1 window = Tk() canvas = Canvas(window,width=WIDTH,height=HEIGHT) canvas.pack() background_photo = PhotoImage(file='space.png') background = canvas.create_image(0,0,image=background_photo,anchor=NW) photo_image = PhotoImage(file='ufo.png') my_image = canvas.create_image(0,0,image=photo_image,anchor=NW) image_width = photo_image.width() image_height = photo_image.height() while True: coordinates = canvas.coords(my_image) print(coordinates) if(coordinates[0]>=(WIDTH-image_width) or coordinates[0]=(HEIGHT-image_height) or coordinates[1]
@Amir_Plays_non_stop
@Amir_Plays_non_stop 3 жыл бұрын
@datrix North West it is used to place the object at the north west of the window
@josephdallinplania7536
@josephdallinplania7536 3 жыл бұрын
What's the version of the Python that you used here? Mine is Python 2.7 and I cannot display the png images, only gif images
@kofe5336
@kofe5336 2 жыл бұрын
0
@emmanuelpoirier4602
@emmanuelpoirier4602 2 жыл бұрын
Hey bro, Great anim. Please add double buffer to prevent screen tearing and also synchronizes refresh with vertical blank line / end of screen refresh. That will make the result smoother. You can also alter the spaceship sprite by inverting it horizontally and vertically according to the bump so the anim is more interesting. And scroll the background to get the whole show more realistic. When you combine both realism with fantasy that creates a contrast which makes things far more fun and interesting. Thanks for the tutorial.
@murat1696
@murat1696 5 ай бұрын
you are the best. You are putting the best efforts possible in your videos. And Also The best phyton are yours.👑👑👑
@FoxnewsControversyReports
@FoxnewsControversyReports Жыл бұрын
You're my best online tutor
@lucyledezma709
@lucyledezma709 4 жыл бұрын
Hey Bro!!. So much time!!! Great Video!!!!
@BroCodez
@BroCodez 4 жыл бұрын
thank you Lucy
@bantuthomas
@bantuthomas 2 жыл бұрын
Great tutorial. Keep it coming.
@nvlprod9958
@nvlprod9958 Жыл бұрын
Bonjour vidéo très bien tournée merci !
@sleshkatgcmc1382
@sleshkatgcmc1382 3 жыл бұрын
Thank you for this tutorial, I am a new user of python, and I use different elements that I just learned and combine them together. Your tutorial helped me to create a little code that make a face animation.
@bodaciouschad
@bodaciouschad Жыл бұрын
This- now THIS is what I was looking for. *chef's kiss* many thanks; I wanted to emulate sprites with tkinter, and I assume I should be able to create buttons with images from here...
@shubhamalhat2011
@shubhamalhat2011 11 ай бұрын
thanks for helping us.. BRO...!!!
@kapibara2440
@kapibara2440 Жыл бұрын
Fantastic!!!
@SmokyDesperado91
@SmokyDesperado91 Жыл бұрын
Great tutorial thanks a lot! Is it possible to store the created animation, e.g. in gif or mp4 format?
@mohamedabdibarre7094
@mohamedabdibarre7094 Жыл бұрын
yes, simply use screen recorder such as Fast Stone Capture eeeeeeeeeee thaaat is ma opinion
@lw9954
@lw9954 2 жыл бұрын
Ty bro!
@kbmangang
@kbmangang 3 жыл бұрын
very interesting, I want to learn animation of graph plotting
@batmanishere4153
@batmanishere4153 3 жыл бұрын
Then I would suggest you to watch matplotlib tutorials
@blexbottt5119
@blexbottt5119 2 жыл бұрын
8:51 have a problem bro, in coordinates[0], "cannot find reference"[" in 'None'
@derpfisti2457
@derpfisti2457 2 жыл бұрын
step 3 = done step 1 = done 👍 step 2 = done 🗯 thats how screensavers were born. Thanks Bro!!!
@dineshgautam7027
@dineshgautam7027 2 жыл бұрын
Great.....
@airlanggak5391
@airlanggak5391 3 жыл бұрын
so cool!
@mrrohan6396
@mrrohan6396 3 жыл бұрын
Hi , can we create an animation for elevator door open and close using python. is it possible?
@sangitakumari5482
@sangitakumari5482 2 жыл бұрын
Life saver video!
@OllyCybSec
@OllyCybSec 8 ай бұрын
This was so Kool learning how to Animate 2D with one image and a different image for the Background‼️🏆
@ManhPham-qh2te
@ManhPham-qh2te 3 жыл бұрын
hey Bro. when i swap the position of 2 lines: canvas.move and if conditions, the image can't bounce back when it reaches the right border and keep sticking that way and moving down 'till it reaches the bottom border. Can you explain that for me
@MLRTrytonix13
@MLRTrytonix13 2 жыл бұрын
If you listened closely, he said why. The conditions need to be before otherwise the image won't bounce back. Stop conditions are always at the beggining of a while loop so when we reenter the loop, we can verify the conditions.
@beingzero7541
@beingzero7541 2 жыл бұрын
Wow!!!
@lochito9384
@lochito9384 3 жыл бұрын
How did you put the image in a file?
@muradarif7373
@muradarif7373 2 жыл бұрын
its actually dark for me too, it would be perfect if he showed everything step by step
@fraionhyudz7053
@fraionhyudz7053 2 жыл бұрын
Hello Bro. Can I ask if animations also works on buttons?
@Amir_Plays_non_stop
@Amir_Plays_non_stop 3 жыл бұрын
How can we fix the error when we close the stop the application? I tried to catch it using try and catch but didn't work.
@davidcalebpaterson7101
@davidcalebpaterson7101 3 жыл бұрын
That error won't show up in the practice since the force stop we have access from console only, you can simply add a key bind with the .quit method function. to be able to close the app without pressing stop in console. hope that helps.
@Amir_Plays_non_stop
@Amir_Plays_non_stop 3 жыл бұрын
@@davidcalebpaterson7101 thanks alot bro!
@davidcalebpaterson7101
@davidcalebpaterson7101 3 жыл бұрын
@@Amir_Plays_non_stop my pleasure to help, I am learning a lot whith these videos, very useful channel I am finding similar channels here and there but this one has helped me the most so far.
@tomaszzdziarski9591
@tomaszzdziarski9591 Жыл бұрын
I found other solution on web: This error is caused by close button on top-right corner of window, the only way you have to stop script. After you click close button, window is destroyed, so no widget, like canvas, exist. You can set a flag to identify if while loop should stop and exit in handler of window close button event. Translating from aliens to human language: add def handler(): global run run = False window.protocol("WM_DELETE_WINDOW", handler) run = True while run : (yours while loop content here) window.destroy() window.mainloop() change in code True for: while run : and before closing a window.mainloop() insert closing a window with: window.destroy()
@Poporoporancio
@Poporoporancio Жыл бұрын
I wish this tutorial was more complete because I spent like 2 hours trying to figure out how to insert the image as a file in pycharm, and then it still didn't work, until I figured out that it doesn't work with jpg for some reason, until I decided to use PNG, why? I don't know, I just started Python yesterday
@tomaszzdziarski9591
@tomaszzdziarski9591 Жыл бұрын
Try inserting jpg but also png files with: space_image = ImageTk.PhotoImage(Image.open("space.jpg")) and then open it normally in canvas with: my_space_image = canvas.create_image(0,0,image=space_image, anchor = NW)
@veggiet2009
@veggiet2009 3 жыл бұрын
Another way to reverse the motion is to write xV *= -1
@shahzodsayfiddinov9510
@shahzodsayfiddinov9510 3 жыл бұрын
Thank you Bro!
@buggopuggo0
@buggopuggo0 3 жыл бұрын
how do you get the image transparent??
@davidcalebpaterson7101
@davidcalebpaterson7101 3 жыл бұрын
There are ready ones on the internet but you can create your own in a photo editor to remove backgrounds manually. Or if you meant a transparency efect you can do that as well in Photoshop for example.
@piggyplayer07
@piggyplayer07 2 жыл бұрын
remove.bg
@cristiucvladimir7909
@cristiucvladimir7909 8 ай бұрын
Thanks.
@HunaBopa
@HunaBopa Жыл бұрын
I am curious to know how you learned all that you learned about Python
@Sunmouse60
@Sunmouse60 15 күн бұрын
cheese
@hydarhydar2338
@hydarhydar2338 2 ай бұрын
@ctorres1992
@ctorres1992 3 жыл бұрын
Thank you so much for this tutorial, can anyone help how to send this to a friend so they can see my progression with coding?
@davidcalebpaterson7101
@davidcalebpaterson7101 3 жыл бұрын
I have a question, xvelocity and yvelocity appear to be in this code just simple variables so I don't get why they worked at all unless they are specific keywords inside python and therefore understood. That is confusing me since they don't seem to be linked to a function or defined piece of logic to perform that action or at least it seems so. for example if I call them something else like my_variable how in the world they are understood. Please send help I'm stuck there. Edit: I understood now cause canvas .move is expecting int coordinates as parameters. Wow. hope that helps someone else too.
@LuqeMax
@LuqeMax 2 жыл бұрын
Then they are not a keywords yeah??
@tomislava741
@tomislava741 8 ай бұрын
my background image is not showing how can i solve this problem?
@FoxnewsControversyReports
@FoxnewsControversyReports Жыл бұрын
Bro code, thanks so much for your help.
@6figguh
@6figguh Жыл бұрын
So this is the code DSTV used for their old decoders
@jhassee
@jhassee 2 жыл бұрын
oh hell yeah
@LuqeMax
@LuqeMax 2 жыл бұрын
Is move() a keywors or its a variable Because its not defined
@lordsubl1me
@lordsubl1me Жыл бұрын
its a class method, canvas is a class that derived from the tkinter properties.
@markhagerman3072
@markhagerman3072 3 жыл бұрын
Am I right that the mainloop function never gets used in this program?
@exg421
@exg421 3 жыл бұрын
it does
@LuqeMax
@LuqeMax 2 жыл бұрын
What if I smallize the letter v in xvelocity
@eklavyajaret8772
@eklavyajaret8772 2 жыл бұрын
bro but what about images
@hamzazad5258
@hamzazad5258 8 ай бұрын
when i place my image on the 0,0 coordinates i find it in the center of the canvas i dont how to solve that...this one did not work for me. i literally copied and pasted his code n same problm occured
@muralikrishna1785
@muralikrishna1785 Жыл бұрын
hey Bro... does PhotoImage support jpg format?
@dennisaguya8449
@dennisaguya8449 9 ай бұрын
are u also having that issue too?
@otpreet
@otpreet 4 жыл бұрын
Don’t give up
@BroCodez
@BroCodez 4 жыл бұрын
I'm still determined, don't worry
@otpreet
@otpreet 4 жыл бұрын
Bro Code imma sub
@htetmin1220
@htetmin1220 3 жыл бұрын
how can i get your images bro
@trickswithandro749
@trickswithandro749 3 жыл бұрын
i perform all the three steps :)
@xiaoduhu5570
@xiaoduhu5570 4 жыл бұрын
Tried to realise your demo, but...it seems tkinter can't show .png with RGB-A with alpha channel.. how do you achieve that, the little ufo.png without background color?!
@turtleeatplastic2386
@turtleeatplastic2386 3 жыл бұрын
it just like dvd
@andriikorniienko4239
@andriikorniienko4239 Жыл бұрын
okay, i did this program, and I already feel how Google and Apple are wants me to work with them😎😂😂😂
Learn Python multiple animations 🎞️
12:16
Bro Code
Рет қаралды 39 М.
Learn Python tkinter labels easy 🏷️
10:28
Bro Code
Рет қаралды 45 М.
“Don’t stop the chances.”
00:44
ISSEI / いっせい
Рет қаралды 62 МЛН
Learn Python tkinter GUI checkboxes easy ✔️
9:36
Bro Code
Рет қаралды 21 М.
Let's code a SNAKE GAME in python! 🐍
33:06
Bro Code
Рет қаралды 682 М.
Learn Python tkinter GUI messageboxes easy 💭
13:19
Bro Code
Рет қаралды 19 М.
Python entry box  ⌨️
10:06
Bro Code
Рет қаралды 26 М.
Learn Python tkinter GUI scales easy 🌡️
10:20
Bro Code
Рет қаралды 15 М.
Python tkinter setup a basic GUI 🐍
8:07
Bro Code
Рет қаралды 99 М.
Python tkinter GUI move images w/ keys 🏎️
11:38
Bro Code
Рет қаралды 28 М.
SQUID GAME in The Strongest Battlegrounds (feat. YouTubers)
10:10
Learn Python tkinter GUI canvases easy 🖍️
12:12
Bro Code
Рет қаралды 18 М.
Её автомобиль никто не хотел ремонтировать!
20:12
Гараж Автоэлектрика
Рет қаралды 1,5 МЛН
LNS - 2 cô gái tốt bụng || Kind 2 girls #shorts
0:47
Linh Nhi Shorts
Рет қаралды 4,2 МЛН
Самые простые строительные леса
0:54
Канал ИДЕЙ
Рет қаралды 1 МЛН
DID YOU NOTICE ANY LAPSES IN THE VIDEO or NOT? / MARGO_FLURY
0:34
MARGO FLURY | Маргарита Дьяченкова
Рет қаралды 12 МЛН
ЛАЙФХАК НА КУХНЕ ! 🧐🤦🏻‍♂️ #shorts #лайфхак
0:15
Крус Костилио
Рет қаралды 109 М.
В Европе заставят Apple сделать в айфонах USB Type-C
0:18
Короче, новости
Рет қаралды 1,1 МЛН