Welcome to the world of imagilib
where Python meets colors, pixels, and a lot of fun! π π€ π©βπ» π± Brought to you by imagi.
You'll see the following emojis next to each section that tell you the (difficulty) level of the learning content:
Adventurer π
Challenger π΅οΈ
Legendary π©βπ»
imagilib
is a unique module or a collection of variables and functions that you can use when you are programming in the imagi app. In addition to imagilib
, only some standard Python libraries can be used in the our app: random
, math
, and datetime
. You can read in more detail about how to use all these libraries, variables and functions below.
imagilib
This section documents the objects and functions in the imagilib
module.
imagilib
is a PythonΒ module that contains all the predefined variables, functions and classes that can be used in the imagi app coding environment (code editor). The imagilib
module is imported into each coding project so that the objects and functions are available from the start.
Adventurer π
Here is a list of the variables that can be used:
m
is our matrix of pixels that we can program to turn on
or off
or even in different colors. It is an array of 64 pixels, arranged in 8 rows and 8 columns. Each element or pixel of the matrix can be accessed using a row and a column index.# Example
m[0][0] = on # this turns on the pixel in the upper left corner of the matrix
m[7][0] = R # this sets the color of the pixel in the bottom left corner to red
R = (255, 0, 0) # red
G = (0, 255, 0) # green
B = (0, 0, 255) # blue
A = (0, 255, 255) # aqua
Y = (255, 255, 0) # yellow
O = (255, 165, 0) # orange
M = (255, 0, 255) # magenta
P = (148, 0, 211) # this is actually the dark violet RGB
W = (255, 255, 255) # white
K = (0, 0, 0) # black
on = (255, 255, 255) # on is the same as white
off = (0, 0, 0) # off is the same as black
# these two pixels have the same color!
m[0][0] = R
m[0][1] = (255, 0, 0)