Pygrr - I've been stupid!

All this time, I've been doing it all wrong... Joking, it's not too bad! You know when I said you must call Object.pack() to update the canvas? I was wrong! Instead of Pygrr creating a new object, there are a few insanely useful Tkinter commands to help with this. These come in the form of:





This may look like nonsense to you, but to Pygrr (which handles all this back-end stuff), it's so valuable! scale() allows me to, well, scale objects from a point by an amount and from a point (x+y), move() allows me to move things (this is what Pygrr currently uses), itemconfigure() allows me to configure settings (such as colour, outline width, and so much more!), and coords() allows me to change an polygon's coordinates - when used with some complex maths, I can rotate objects, or even change their model... Hallelujah!

I'll show you... Here's what now happens if you dynamically call the Object.set_model() when the object exists... No more pesky Object.pack(), it just works...

Here's the code:

import pygrr


player = pygrr.Object()


i = 0

while True: # this is the game loop!




    i += 1

The same can be said for colours, too! Let's make a rainbow circle!

Very nice! This works for all of the graphics functions, and models!
In the next post, I'll add rotational functions, and scaling. Until then;

Isaac, over and out...

Popular posts from this blog

Messing around with procedural art - Turtle graphics

The fossils of Morocco | Mosasaurus beaugei

Blog post #0 - Hello, world!