pydraw
  • Home
  • Documentation
  • Guides
    • Installation and Setup
    • Getting Started
    • Quickstart Examples
  • Quick Reference
    • Screen
    • Color
    • Location
    • Renderable
    • Text
    • Line
    • Image
    • Input
    • Scene
Powered by GitBook
On this page

Was this helpful?

  1. Guides

Getting Started

Starter Template and an Example Program for pyDraw

Now that we have pydraw installed, we can write a base program:

from pydraw import *

screen = Screen(800, 600)

# code goes here!

screen.stop()

Note that you could also replace line 7 with this to support animation:

fps = 30
running = True
while running:
    screen.update()
    screen.sleep(1 / fps)

Example Program

We can go ahead and add some shapes:

from pydraw import *

screen = Screen(800, 600)

box = Rectangle(screen, 50, 50, 50, 50)
triangle = Triangle(screen, 150, 150, 50, 50)
circle = Oval(screen, 250, 250, 50, 50)
hexagon = Polygon(screen, 6, 350, 350, 50, 50)

screen.stop()

And the following output will be produced:

PreviousInstallation and SetupNextQuickstart Examples

Last updated 4 years ago

Was this helpful?

Output for the Example Above