#Tkinter very laggy
20 messages · Page 1 of 1 (latest)
You should share your code and explain what you mean by "laggy"
alright, give me a minute sorry
@fallen pier
these are the images in "images"
i don't know how to link them sorry
but the issue is that (currently i only have movement of the ufo) the ufo moves smoothly for the first 3-5 seconds before it begins progressively slowing down more and more
maybe you are overloading the screen
yes, but with how i understand it i don't know how to lessen the load, because i don't know how to draw the background without it being in the function that updates every frame
I'm not familiar with how tkinter's canvas works. I'm not sure it's the best way to implement a game though... Have you tried PyGame? It's designed to do this kinda stuff...
it says for school project so he probably has to use it
i would use pygame, but like triangular fish said it is a school project so unfortunately i must make do with what i have
My guess would be that it's slow because you're creating new objects every update. From a quick Google search it seems that you need to create each object once and then move it as necessary, I didn't find an example of how though
alright, i think that its a little bit more complicated then that because the projects necessitates that everything needs to be a function, but thanks nonetheless
This wouldn't change the usage of functions. It'd change how you update each item on the screen
Rather than creating a new one every time, you'd create them once. Then when you need to update them, rather than creating a new one, you'd instead update the existing ones.
right but one pf the functions is call game and it updates every frame so maybe i can add a new function later on, thanks!
You'd just change that function to update all your objects
For example, if the BG never moves, can’t you create it once? and never need to remake the object?