If you've picked up Unicorn Hat and want to give Unicorn Paint a go, then this is the guide for you.
Unicorn Paint is an advanced example, and assumes some basic knowledge that not everyone will have. We're going to try and fill those gaps below.
Installing modules can be trickier than it looks, the process for Python 2 and Python 3 is subtly different. We've tried to make the install process as simple as possible with this magical one liner:
curl https://get.pimoroni.com/unicornhat | bash
You'll need to locate LXTerminal, or be logged into your Raspberry Pi's terminal to run this script. You can find out more about Unicorn Hat, and the setup process by reading our getting started with Unicorn Hat guide
This script will also prompt you to download the example code, make sure you answer yes. If you miss it, or need a fresh copy of the examples for any reason you can "clone" them with Git:
git clone https://github.com/pimoroni/unicornhat
If you're using the web browser on your Pi, you can simply skip this step and substitute the IP address we're looking for with 127.0.0.1. This is the "local loopback" IP, and simply tells your browser to talk to the machine its running on, rather than look for another one across the network. In order to connect to your Pi from a web browser and use Unicorn Paint, you'll need to find your Pi's IP Address. Its IP address is like a postal address, and allows you to find your Pi on your local network.
If you know how to do this, go right ahead, otherwise read our guide to finding your Raspberry Pi's IP address
At the end of this kerfuffle you should be in possession of a number that looks something like: 192.168.1.123 or perhaps 10.0.1.123. Make a note of it.
Before starting Unicorn Paint, you should make sure the dependencies are installed. Unicorn Paint requires the Python web framework Flask. To get it installed, just:
sudo pip install flask
Locate the code you downloaded earlier and make your way to the Unicorn Paint example folder. Then just type:
And Unicorn Paint should fire up on your Pi. Note: you won't see any graphical interface yet, we need to connect with a web browser from another computer, or your Pi, to get things working.
If you're running entirely on the Raspberry Pi, I'm going to assume you've got a desktop up and have Epiphany Browser installed. You should see an icon for it on your desktop if you do, click it and enter the following into the address bar:
If you've got the paint.py example running, you should see the interface pop up and be able to start painting. Enjoy!
If you're using a desktop PC or laptop, you'll have to use the IP Address that you found earlier and plug it into the address bar of your browser of choice. For example:
Hopefully the Unicorn Paint UI will come right up. Happy painting!
Need something for this project? You can use the links below to add products to your Pimoroni Shop basket for easy checkout.