VEX V5 Python API
|
Use the LCD class to write or draw to the LCD The LCD screen has a resolution of 480x240 pixels. More...
Public Member Functions | |
def | __init__ (self, parent) |
Use the LCD class to write or draw to the LCD. More... | |
def | set_cursor (self, row, col) |
Sets the cursor to the row and column number set in the parameters. More... | |
def | set_font (self, font) |
Sets the font type to be displayed on the LCD that is determined by the parameter. More... | |
def | set_pen_width (self, width) |
Sets the pen width to the determined by the parameter set in the command. More... | |
def | set_origin (self, x, y) |
Sets the origin of the LCD screen to the parameters defined in the function. More... | |
def | column (self) |
An integer type represents the a column on the LCD screen. More... | |
def | row (self) |
An integer type represents the a row on the LCD screen. More... | |
def | set_pen_color (self, color) |
Sets the color of the pen to a specified color. More... | |
def | set_pen_color_hue (self, hue) |
Sets the color of the pen to a specified color. More... | |
def | set_fill_color (self, color) |
Sets the background fill color of the LCD screen to the specified color. More... | |
def | set_fill_color_hue (self, color) |
def | get_string_width (self, text) |
Gets the width in pixels of the given string. More... | |
def | get_string_height (self, text) |
Gets the height in pixels of the given string. More... | |
def | print_ (self, text, new_line=True) |
Print a string to the screen at the cursor location. More... | |
def | print_line (self, number, text) |
Print a string to the screen at a specific line. More... | |
def | print_at (self, x, y, opaque, text) |
Prints a string at an x, y location with the ability to be transparent. More... | |
def | clear_screen (self, color=None) |
Clears the whole LCD to a default color or otherwise specified color. More... | |
def | clear_screen_hue (self, hue) |
Clears the whole LCD to a default color or otherwise specified color. More... | |
def | clear_line (self, number=None, color=None) |
Clears the specified line and sets it to a specified color. More... | |
def | clear_line_hue (self, number, hue) |
def | new_line (self) |
Clears the rest of the line from where the cursor is located and then moves the cursor to the beginning of the next line. More... | |
def | draw_pixel (self, x, y) |
Draws a single pixel to the LCD screen in the specified x and y location. More... | |
def | draw_line (self, x1, y1, x2, y2) |
Draws a line connecting the two specified points in the parameters. More... | |
def | draw_rectangle (self, x, y, width, height, color=None) |
Draws a rectangle using the specified points and attributes set in the parameters. More... | |
def | draw_rectangle_hue (self, x, y, width, height, hue) |
def | draw_circle (self, x, y, radius, color=None) |
Draws a circle using the specified points and attributes set in the parameters. More... | |
def | draw_circle_hue (self, x, y, radius, hue) |
def | draw_bitmap (self, bitmap, x=0, y=0) |
Draws a bitmap image on the screen. More... | |
def | draw_image_from_buffer (self, buffer, x=0, y=0) |
Draws an image on the screen using the contents of the memory buffer. More... | |
def | draw_image_from_buffer_raw (self, buffer, x, y, width, height) |
Draws an image on the screen using the contents of the memory buffer. More... | |
def | draw_image_from_file (self, filename, x=0, y=0) |
Draws an image on the screen using a file on the SD Card as the source. More... | |
def | draw_eyes (self, eyes) |
Draws eye graphics on the screen. More... | |
def | x_position (self) |
Gets the last x location pressed on the screen. More... | |
def | y_position (self) |
Gets the last y location pressed on the screen. More... | |
def | pressing (self) |
Gets the pressed status of the LCD. More... | |
def | render (self, vsync_wait=True) |
Switches to double buffering or renders back buffer to screen. More... | |
Use the LCD class to write or draw to the LCD The LCD screen has a resolution of 480x240 pixels.
def vex.BrainLcd.__init__ | ( | self, | |
parent | |||
) |
Use the LCD class to write or draw to the LCD.
The LCD screen has a resolution of 480x240 pixels
def vex.BrainLcd.set_cursor | ( | self, | |
row, | |||
col | |||
) |
Sets the cursor to the row and column number set in the parameters.
row | Sets the row number for where the cursor is placed. |
col | Sets the column number for where the cursor is placed. |
def vex.BrainLcd.set_font | ( | self, | |
font | |||
) |
Sets the font type to be displayed on the LCD that is determined by the parameter.
font | Font enum value. |
def vex.BrainLcd.set_pen_width | ( | self, | |
width | |||
) |
Sets the pen width to the determined by the parameter set in the command.
width | The width of the pen when drawing. A larger width equals a wider pen stroke. |
def vex.BrainLcd.set_origin | ( | self, | |
x, | |||
y | |||
) |
Sets the origin of the LCD screen to the parameters defined in the function.
x | The x location of the origin. |
y | The y location of the origin. |
def vex.BrainLcd.column | ( | self | ) |
An integer type represents the a column on the LCD screen.
def vex.BrainLcd.row | ( | self | ) |
An integer type represents the a row on the LCD screen.
def vex.BrainLcd.set_pen_color | ( | self, | |
color | |||
) |
Sets the color of the pen to a specified color.
color | 0xRRGGBB color, Color enum value or a string like "#rrggbb" or "#rgb" |
def vex.BrainLcd.set_pen_color_hue | ( | self, | |
hue | |||
) |
Sets the color of the pen to a specified color.
hue | An integer that represents the hue of the color. |
def vex.BrainLcd.set_fill_color | ( | self, | |
color | |||
) |
Sets the background fill color of the LCD screen to the specified color.
*
color | A color unit where colors can be defined as names. |
def vex.BrainLcd.set_fill_color_hue | ( | self, | |
color | |||
) |
def vex.BrainLcd.get_string_width | ( | self, | |
text | |||
) |
Gets the width in pixels of the given string.
def vex.BrainLcd.get_string_height | ( | self, | |
text | |||
) |
Gets the height in pixels of the given string.
def vex.BrainLcd.print_ | ( | self, | |
text, | |||
new_line = True |
|||
) |
Print a string to the screen at the cursor location.
text | object to print, usually a string. For multiple arguments, use format like "x: %g y: %g" % (x, y) -> "x: 123 y: 456" Supported format flags are g (all) x (hex) d (int) f (float) |
new_line |
def vex.BrainLcd.print_line | ( | self, | |
number, | |||
text | |||
) |
Print a string to the screen at a specific line.
number | line number to print on, 1 is top line. |
text | object to print, usually a string. For multiple arguments, use format like "x: %g y: %g" % (x, y) -> "x: 123 y: 456" Supported format flags are g (all) x (hex) d (int) f (float) |
def vex.BrainLcd.print_at | ( | self, | |
x, | |||
y, | |||
opaque, | |||
text | |||
) |
Prints a string at an x, y location with the ability to be transparent.
x | The x location of where the print should start |
y | The y location of the baseline where the print should start |
opaque | If set to false, the print will be transparent. |
text | object to print, usually a string. |
def vex.BrainLcd.clear_screen | ( | self, | |
color = None |
|||
) |
Clears the whole LCD to a default color or otherwise specified color.
color | A color unit where colors can be defined as names. |
def vex.BrainLcd.clear_screen_hue | ( | self, | |
hue | |||
) |
Clears the whole LCD to a default color or otherwise specified color.
hue | An integer that represents the hue of the color. |
def vex.BrainLcd.clear_line | ( | self, | |
number = None , |
|||
color = None |
|||
) |
Clears the specified line and sets it to a specified color.
number | An integer that sets the line that is to be cleared. |
color | A color unit where colors can be defined as names. |
def vex.BrainLcd.clear_line_hue | ( | self, | |
number, | |||
hue | |||
) |
def vex.BrainLcd.new_line | ( | self | ) |
Clears the rest of the line from where the cursor is located and then moves the cursor to the beginning of the next line.
def vex.BrainLcd.draw_pixel | ( | self, | |
x, | |||
y | |||
) |
Draws a single pixel to the LCD screen in the specified x and y location.
x | The x location of where to draw the pixel. |
y | The y location of where to draw the pixel. |
def vex.BrainLcd.draw_line | ( | self, | |
x1, | |||
y1, | |||
x2, | |||
y2 | |||
) |
Draws a line connecting the two specified points in the parameters.
x1 | The x location of the first point. |
y1 | The y location of the first point. |
x2 | The x location of the second point. |
y2 | The y location of the second point. |
def vex.BrainLcd.draw_rectangle | ( | self, | |
x, | |||
y, | |||
width, | |||
height, | |||
color = None |
|||
) |
Draws a rectangle using the specified points and attributes set in the parameters.
Fills the rectangle with a default color unless specified.
x | The top left x location of the rectangle. |
y | The top left y location of the rectangle. |
width | The width of the rectangle. |
height | The height of the rectangle. |
color |
def vex.BrainLcd.draw_rectangle_hue | ( | self, | |
x, | |||
y, | |||
width, | |||
height, | |||
hue | |||
) |
def vex.BrainLcd.draw_circle | ( | self, | |
x, | |||
y, | |||
radius, | |||
color = None |
|||
) |
Draws a circle using the specified points and attributes set in the parameters.
Fills the circle with a default color unless specified.
x | The central x location of the circle. |
y | The central y location of the circle. |
radius | Sets the redius of the circle to be drawn on the LCD. |
color |
def vex.BrainLcd.draw_circle_hue | ( | self, | |
x, | |||
y, | |||
radius, | |||
hue | |||
) |
def vex.BrainLcd.draw_bitmap | ( | self, | |
bitmap, | |||
x = 0 , |
|||
y = 0 |
|||
) |
Draws a bitmap image on the screen.
bitmap | The bitmap image to draw (Bitmap object) |
x | The left-coordinate of the bitmap (default 0) |
y | The top-coordinate of the bitmap (default 0) |
def vex.BrainLcd.draw_image_from_buffer | ( | self, | |
buffer, | |||
x = 0 , |
|||
y = 0 |
|||
) |
Draws an image on the screen using the contents of the memory buffer.
buffer | a buffer containing image data in bmp or png format. |
x | The x-coordinate at which the left edge of the image will be drawn. |
y | The y-coordinate at which the top edge of the image will be drawn. |
This function draws an image on the screen using the contents of a buffer into which either BMP or PNG raw data has already been read. The contents may have come from a file on the SD card or have been statically declared in the code. The image should be no larger than the V5 Screen, that is, a maximum of 480 pixels wide by 272 pixels high. The top/left corner of the image is placed at the coordinates given by x and y, these can be negative if desired.
def vex.BrainLcd.draw_image_from_buffer_raw | ( | self, | |
buffer, | |||
x, | |||
y, | |||
width, | |||
height | |||
) |
Draws an image on the screen using the contents of the memory buffer.
buffer | A buffer containing raw 32 bit per pixel image data. |
x | The x-coordinate at which the left edge of the image will be drawn. |
y | The y-coordinate at which the top edge of the image will be drawn. |
width | The width of the image. |
height | The height of the image. |
This funtion draws an image on the screen using the contents of a buffer into which raw RGB pixels have been placed. Each pixel is represented by a 32 bit value, however, only the lower 24 bits are used as transparency is not yet supported. The buffer contains pixels for the first row of the image immediately followed by pixels for the second row and so on. The image should be no larger than the V5 Screen, that is, a maximum of 480 pixels wide by 272 pixels high. The top/left corner of the image is placed at the coordinates given by x and y, these can be negative if desired.
def vex.BrainLcd.draw_image_from_file | ( | self, | |
filename, | |||
x = 0 , |
|||
y = 0 |
|||
) |
Draws an image on the screen using a file on the SD Card as the source.
filename | The name of the image, it must have either a ".bmp" or ".png" extension. |
x | The x-coordinate at which the left edge of the image will be drawn. |
y | The y-coordinate at which the top edge of the image will be drawn. |
This funtion draws an image on the screen using the contents of a file on an SD Card. The file should be no larger than 512K bytes and must have either a ".bmp" or ".png" extension. The image should be no larger than the V5 Screen, that is, a maximum of 480 pixels wide by 272 pixels high. The top/left corner of the image is placed at the coordinates given by x and y, these can be negative if desired.
def vex.BrainLcd.draw_eyes | ( | self, | |
eyes | |||
) |
Draws eye graphics on the screen.
eyes | eyes bitmap id, a vex.Eyes.XYZ constant value |
def vex.BrainLcd.x_position | ( | self | ) |
Gets the last x location pressed on the screen.
def vex.BrainLcd.y_position | ( | self | ) |
Gets the last y location pressed on the screen.
def vex.BrainLcd.pressing | ( | self | ) |
Gets the pressed status of the LCD.
def vex.BrainLcd.render | ( | self, | |
vsync_wait = True |
|||
) |
Switches to double buffering or renders back buffer to screen.