Quickstart Examples
Some examples to quickly begin creating amazing things with pyDraw!
Example #1: Drawing
We can draw a simple emoji onto the screen with Ovals. We will mimic: "😯" with a gray background.
from pydraw import *
screen = Screen(800, 600)
screen.color(Color('gray'))
face = Oval(screen, 100, 0, 600, 600, Color('yellow'))
face.wedges(40)
eye1 = Oval(screen, 200, 200, 85.71, 100)
eye2 = Oval(screen, 500, 200, 85.71, 100)
eyebrow1 = Rectangle(screen, 157.14, 150, 100, 5, rotation=-16)
eyebrow2 = Rectangle(screen, 517.85, 150, 100, 5, rotation=16)
mouth = Oval(screen, 350, 400, 85.71, face.height() / 109)
screen.stop()
Example #2: Animation
We can animate our face now by adding an animation loop and having our eyes blink every 3 seconds (note that we've now switched to the proportions-based calculations):

Example #3: Input
Now we will move our emoji's mouth based on the mouse's position:

Last updated
Was this helpful?