A new guide in the Adafruit Learning System: PyPaint Drawing Program In CircuitPython
The latest crop of smart displays from Adafruit, including PyPortal, PyBadge and PyGamer, have screens and an input method. This makes them all ideal for running a simple paint program using our favorite introductory language – CircuitPython. And if you received AdaBox 012, you have a PyGamer in your hands!
CircuitPython is a programming language based on Python, one of the fastest growing programming languages in the world. It is specifically designed to simplify experimenting and learning to code on low-cost microcontroller boards. Here is a guide which covers the basics:
You will want at least CircuitPython version 4.1 (possibly a beta version of it) for maximum graphics performance, it’s FAST!
All platforms have a palette on the left edge of the screen that contains 8 colors and two brush sizes. selecting a color changes the active drawing color, while selecting one of the brush cursors will change the drawing cursor as well as the size of the brush: 1 pixel square or 3 pixels square.
On the PyPortal, Use the touch screen to control the cursor. A simple stylus works really well for this. Touch on the palette to change the drawing color or brush. Touch anywhere else to place a spot of the current drawing color at the touched location. Moving while touching the screen will leave a trail. Recall that each time a change in touch location is detected, a line is drawn from the previous location to the new one. That means that if you move faster than the update cycle, you’ll get a polygon because points are relatively far apart. You can see this in the photo below. If you want a smooth curved line, move slowly.