Module display
Display and bmp drawing functions
on() |
Turn the display on |
off() |
Turn the display off |
screenshot([filename[, mode]]) |
Take a screenshot |
clear() |
Clear the screen |
print(text, x, y[, font[, fg[, bg[, max_width]]]]) |
Print text to the screen. |
pixel(x, y[, color]) |
Set a pixel to a color
(omit color param to read the current color) |
line(x1, y1, x2, y2, color) |
Draw a line |
rect(x, y, w, h, stroke[, fill]) |
Draw a rect |
circle(x, y, r, stroke[, fill]) |
Draw a circle |
load(filename) |
Loads a bitmap file so it can be drawn on the screen |
draw(draw_func) |
Runs the given function and double-buffers all the drawing done by the function
Then copies the buffer back to the actual screen buffer when the function returns
Use this to avoid flickering when drawing |
notify_box(text[, timeout=1000]) |
Prints a message on the screen for a period of time |
width |
The width of the display (720) |
height |
The height of the display (480) |
Functions
-
on()
-
Turn the display on
-
off()
-
Turn the display off
-
screenshot([filename[, mode]])
-
Take a screenshot
Parameters:
- filename
string
(optional)
- mode
int
(optional)
-
clear()
-
Clear the screen
-
print(text, x, y[, font[, fg[, bg[, max_width]]]])
-
Print text to the screen.
Parameters:
Returns:
string
any remaining characters that wouldn't fit on the screen
-
pixel(x, y[, color])
-
Set a pixel to a color
(omit color param to read the current color)
Parameters:
Returns:
color constants.COLOR
-
line(x1, y1, x2, y2, color)
-
Draw a line
Parameters:
-
rect(x, y, w, h, stroke[, fill])
-
Draw a rect
Parameters:
-
circle(x, y, r, stroke[, fill])
-
Draw a circle
Parameters:
-
load(filename)
-
Loads a bitmap file so it can be drawn on the screen
Parameters:
Returns:
bitmap
-
draw(draw_func)
-
Runs the given function and double-buffers all the drawing done by the function
Then copies the buffer back to the actual screen buffer when the function returns
Use this to avoid flickering when drawing
Parameters:
-
notify_box(text[, timeout=1000])
-
Prints a message on the screen for a period of time
Parameters:
- text
string
- timeout
int
in ms
(default 1000)
Fields
-
width
-
The width of the display (720)
-
height
-
The height of the display (480)
Class bitmap
Represents a bitmap file that has been loaded
-
bitmap:draw(x, y[, w[, h]])
-
Draws this bitmap image to the screen
Parameters:
- x
int
- y
int
- w
int
(optional)
- h
int
(optional)
-
bitmap.bits_per_pixel
-
Get the bits per pixel
-
bitmap.width
-
Get the image width
-
bitmap.height
-
Get the image height
-
bitmap.num_colors
-
Get the number of colors
-
bitmap.size
-
Get the image size
-
bitmap.signature
-
Get the image signature
-
bitmap.hpix_per_meter
-
Get the image horizontal resolution
-
bitmap.vpix_per_meter
-
Get the image vertical resolution