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.

Predefined (system) variables

Adventurer πŸ™‹

Here is a list of the variables that can be used:

# 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)