If you've picked up Unicorn HAT or pHAT and want to give Unicorn Paint a go, then this is the guide for you.
Unicorn Paint 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. For Unicorn pHAT, check out getting started with Unicorn pHAT guide.
This script will automatically prompt you to download the project code, so make sure you answer yes. If you miss it, or need a fresh copy of the project for any reason you can "clone" them with Git:
git clone https://github.com/pimoroni/unicorn-hat
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 it's 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. The script above will have installed it for you but if needs be you can install it manually, like so:
sudo apt-get install python-flask python3-flask
Locate the code you downloaded earlier and make your way to the Unicorn Paint project folder. If you use the one-line installer, it will be located in the
/home/pi/Pimoroni/unicornhat/projects/ 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 a browser such as Chromium or Epiphany 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 project 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.