VEXcode V5 Python print at pixel level with transparency, rgb colors

So we are porting 4 years of code from RMS Python to VEXcode V5 Python and have some API /syntax questions:

  1. In RMS we were able to print text to brain lcd at pixel level with a printAt(x coord, y coord, opaque…) command. We used it to position labels nicely on a custom menu screen and the transparency feature was nice. We see the function defined in the API at VEX Help but can’t find it in VEXcode V5 Python.

  2. Colors - we used to code our own colors with vex.Color.from_rgb(r, g, b) and if I recall there was a hue option as well. In VEXCode V5 Python we can only see 10 predefined colors defined by name (WHITE, RED, etc…) Is there a way to define/use custom rgb/hue colors?

1 Like

use brain.screen.print_at

brain.screen.print_at("Hello", x=10, y=120)
brain.screen.print_at("Hello", x=10, y=90, opaque=False)

create colors using RGB, for example, using the REPL.

>>> c1=Color(0x804000)
>>> c1
Color 00804000
>>> brain.screen.clear_screen(c1)
>>> c2=Color(255,0,255)
>>> c2
Color 00FF00FF
>>> brain.screen.clear_screen(c2)

web colors

>>> Color.
__class__       __name__        value           __bases__
__dict__        BLACK           BLUE            CYAN
GREEN           ORANGE          PURPLE          RED
TRANSPARENT     WHITE           YELLOW          hsv
is_transparent  rgb             web
>>> c3=Color('#F00')
>>> c3
Color 00FF0000
>>> c4=Color('#804020')
>>> c4
Color 00804020

using hsv values to modify a color

>>> c4.hsv(120,1.0,1.0)
>>> c4
Color 0000FF00
>>> c4.hsv(150,1.0,1.0)
>>> c4
Color 0000FF7F

see this for REPL


@jpearman : Thank you. Got REPL working. It’s a whole new world!!!

So if I tab I get a list of all available modules classes and functions. To get to the print_at I would do brain. then TAB then see all options, type brain.screen. then TAB etc… until I would know that brain.screen.print_at is a valid defined function. Is there a trick to find out the parameters this function needs? For example chances are slim that I would had figured out the whole syntax in its proper order - well maybe after an hour or so of trying - (“Hello”, x=10, y=90, opaque=False)? I know big Python has a module called signature or inspect or something similar.

yea, that’s an issue.
REPL is not supposed to be a help document, it just lets you play interactively with the API. VEXcode has help on many functions, but they limited what is shown in the sidebar and for some reason the VEXcode team doesn’t like the print_at function in either C++ or Python. We need better documentation, but no one has written that, for the time being just keep asking me I guess. Many of the functions follow the C++ API, but some were adjusted to make them more inline with standard Python practices.


Thanks for your help as always.

They also absolutely hate the button.pressed and button.released ones as well LOL. Sometimes it is useful to know when something was released, ex. the touch screen.