To install pypen, make sure you have Python 3.8 or higher installed as well as pip configured and available in your PATH. Once that's done, simply do pip install pypen
. To verify that it was installed correctly, run pypen --version
(or python -m pypen --version
) and it should display the current version of PyPen.
Since Cairo - one of PyPen's dependencies - sometimes can be a bit tricky to install, see our OS-specific instructions available here:
To create a basic sketch, just call pypen --init pypen_example.py
(or whatever you want). This creates a file named 'pypen_example.py' (or whatever you provided the pypen --init
with) which contains some PyPen code looking like this:
from pypen import *
def start():
settings.fps = 60
def update():
fill("orange")
rectangle(20, 20, 300, 400, "red")
(You of course don't have to use pypen --init to create all your sketches, but it's very convenient)
You can then run it by simply calling:
pypen pypen_example.py
- (or
python -m pypen pypen_example.py
)
If everything worked, a window should launch containing something looking like this:
Wohoo! You made it! You have now launched your first PyPen sketch! Try changing some variables like the color from "red"
to "blue"
or the width and height of the rectangle (or maybe even change it into a circle!).
There is much more that PyPen can do that you have yet to discover. Interested in seeing how simple it is to use PyPen? We have an entire folder filled with interesting PyPen examples spanning from very simple to some more advanced ones as well. You find them in the 'examples/' folder on our repository located here:
You can also refer to our documentation available here: