Opening unicorn hd paint projects


#1

When I try and reload a unicorn paint project in thonny I get a invalid syntax on the middle 0 on
pixels [[[ 0 0 0 ] how can i display this file on the unicorn hat hd?


#2

Do you have an example of a project? It sounds like there might be a bug in the save function that’s causing commas to be missed from the pixels. It should be [0, 0, 0]


#3

Sure thing, as well when I click the bucket next to the pencil it freezes the program

#!/usr/bin/env python
import unicornhat, signal
pixels = [[[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]]

[[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[207 157 111]
[ 66 43 23]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]]

[[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 0 0]
[132 0 0]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]]

[[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 0 0]
[132 0 0]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]]

[[255 255 255]
[255 255 255]
[255 255 255]
[ 0 0 0]
[255 255 255]
[255 255 255]
[255 255 255]
[255 0 0]
[132 0 0]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]]

[[255 255 255]
[ 0 0 0]
[ 0 0 0]
[ 0 0 0]
[255 255 255]
[255 255 255]
[255 0 0]
[132 0 0]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]]

[[ 0 0 0]
[ 0 0 0]
[ 0 0 0]
[132 0 0]
[193 129 70]
[ 46 31 16]
[ 46 31 16]
[255 0 0]
[132 0 0]
[132 0 0]
[ 66 43 23]
[ 66 43 23]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]]

[[ 0 0 0]
[132 0 0]
[132 0 0]
[ 0 0 0]
[ 0 132 132]
[193 129 70]
[ 66 43 23]
[ 46 31 16]
[255 0 0]
[255 0 0]
[ 66 43 23]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]]

[[ 0 0 0]
[132 0 0]
[198 198 198]
[ 0 0 0]
[207 157 111]
[207 157 111]
[ 66 43 23]
[ 66 43 23]
[ 46 31 16]
[255 0 0]
[ 66 43 23]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]]

[[ 0 0 0]
[132 0 0]
[132 0 0]
[ 0 0 0]
[ 0 132 132]
[207 157 111]
[ 66 43 23]
[ 66 43 23]
[255 0 0]
[255 0 0]
[ 66 43 23]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]]

[[255 255 255]
[ 0 0 0]
[ 0 0 0]
[132 0 0]
[255 255 255]
[255 255 255]
[255 0 0]
[132 0 0]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]]

[[255 255 255]
[255 255 255]
[255 255 255]
[ 0 0 0]
[255 255 255]
[255 255 255]
[255 255 255]
[255 0 0]
[132 0 0]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]]

[[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 0 0]
[132 0 0]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]]

[[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 0 0]
[132 0 0]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]]

[[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[207 157 111]
[ 66 43 23]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]]

[[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]]]
unicornhat.set_pixels(pixels)
unicornhat.show()
signal.pause()


#4

I notice in the terminal it saves with commas?
(u’gg’, array([[[ 0, 0, 0],
[ 0, 0, 0],
[ 0, 0, 0],
[ 0, 0, 0],
[ 0, 0, 0],
[ 0, 0, 0],
[ 0, 0, 0],
[ 0, 0, 0],
[ 0, 0, 0],
[ 0, 0, 0],
[ 0, 0, 0],
[ 0, 0, 0],
[ 0, 0, 0],
[ 0, 0, 0],
[ 0, 0, 0],
[ 0, 0, 0]],

   [[  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0]],

   [[  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0]],

   [[  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0]],

   [[  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0]],

   [[  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [132,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0]],

   [[  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [132,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0]],

   [[  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [132,   0,   0],
    [132,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0]],

   [[  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [132,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [132,   0,   0],
    [  0,   0,   0],
    [132,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0]],

   [[  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0]],

   [[  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [132,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [132,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [132,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0]],

   [[  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [132,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [132,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [132,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0]],

   [[  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [132,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0]],

   [[  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0]],

   [[  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0]],

   [[  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0],
    [  0,   0,   0]]]))

127.0.0.1 - - [22/May/2018 04:08:33] “GET /save/gg?_=1526962103615 HTTP/1.1” 200


#5

Yep, this is a bug that was fixed back in January, but because of the way our one-line-installer works it wont have pulled down the fixed version :(

You should replace your local paint.py with this one: https://github.com/pimoroni/unicorn-hat-hd/blob/master/projects/unicornpaint/paint.py

You can fix your existing saves by adding in the missing commas- a good multi-cursor editor like VSCode should make that relatively painless.

Unicorn HAT HD uses a slightly different display routine. too:

import unicornhathd
import signal
unicornhathd.rotation(0)
pixels = [] # <--- Fixed save data should go here
for x in range(unicornhathd.WIDTH):
    for y in range(unicornhathd.HEIGHT):
        r, g, b = pixels[x][y]
        unicornhathd.set_pixel(x, y, r, g, b)
unicornhathd.show()
print("\nShowing: {}\nPress Ctrl+C to exit!")
signal.pause()

#6

thanks so much for that, works now, as a side note the top right bin icon seems to crash the program, not sure why