何かを描く / screen.draw

日経ソフトウエア 2020年 3 月号, pp.42ff.

pip自体をアップグレードしてから(しなくてもよい)、

py -m pip install -U pip

Pygame Zeroをpipする。

py -m pip install pgzero
import pgzrun

WIDTH = 318
HEIGHT = 212

def draw():    
    screen.clear()
    #((cx, cy), 半径, (r, g, b))    
    screen.draw.circle((WIDTH/2, HEIGHT/2), int(HEIGHT/2), "white")
    
pgzrun.go()

f:id:ti-nspire:20201203053022p:plain
circleのほかにfilled_circle, filled_rect, line, rect, text, textbox