More pygame drawing options.



  • I'm looking to use some more of the pygame drawing functions: polygon, circle, ellipse and arc. I'm wondering how easy it is to do that... would I have to create a specific class (such as is used in graphics.py) or is there an easier way to do it?
    Easiest of all (for me!) would be to have graphics.py support additional drawing objects.
    I'm trying to draw a simple wind direction graphic with a circle representing the compass and a small triangle indicating wind direction. Polygon and circle would do the job nicely, but would prefer not to have to basically create a new version of graphics.py to add simple support


  • Core team

    Because Tingbot libs are built on top of pygame, all those functions are available for use as well as the tingbot-python functions. You just use them with screen.surface as the pygame drawing surface.

    Here's an example:

    import tingbot
    from tingbot import *
    import pygame
    
    @every(seconds=1.0/30)
    def loop():
        screen.fill(color='black')
        
        pygame.draw.circle(
            screen.surface,
            (255, 255, 255),
            (120, 120),
            100,
        )
    
    tingbot.run()
    


  • Awesome. Thanks for the help. I thought it would be easier than having to create a new class, but my familiarity with Python is limited.
    I look forward to drawing some more fun stuff!


Log in to reply

Looks like your connection to More pygame drawing options. was lost, please wait while we try to reconnect.