rcute_cozmars.screen¶
-
class
rcute_cozmars.screen.Screen(robot)¶ -
resolution¶ (240, 135), read-only
-
block_display(image, x, y)¶ display an image on the screen starting from (x, y)
raises AssertionError: raise error when the area to display exceeds screen
-
brightness¶ get/set brightness at
default_speed, 0~1, default is 0.05
-
display(image, fill_type='stretch', stop_eyes=True)¶ Display image on screen
参数: - image (PIL.Image/numpy.ndarray) – BGR image to be displayed. The image will be resized to fit the screen,
- fill_type (str, optional) – must be one of ‘stretch’/’crop’/’adapt’, default to ‘stretch’
-
fill(color, x=0, y=0, w=240, h=135, stop_eyes=True)¶ Fill the screen in block
参数: - color (str/tuple) – BGR mode
- x (int) – The x coordinate of the upper left corner of the filled square, the default is 0
- y (int) – The y coordinate of the upper left corner of the filled square, the default is 0
- w (int) – the width of the filled square, the default is the screen width 240
- h (int) – The width of the filled square, the default is the screen height 135
引发: ValueError – throw an exception when the filled area exceeds the screen area
-
max_brightness¶ 1.0, read only
-
min_brightness¶ Minimum brightness, 0, that is, totally dark, read only
-
set_brightness(brightness, *, fade_duration=None, fade_speed=None)¶ 参数: - brightness (float) – 0~1
- fade_duration (float) – in seconds, the default is None, which means no fade
- fade_speed (float) – fade speed (/s), the default is None, which means no fade
引发: TypeError – fade_duration and fade_speed cannot both be set, otherwise an exception will be thrown
-
set_pixel(x, y, color)¶ Set color of a pixel on screen.
参数: - x (int) – the x coordinate of the pixel to be set
- y (int) – the y coordinate of the pixel to be set
- color (str/tuple) – BGR mode
引发: ValueError – An exception is thrown when the coordinates exceed the screen area
-
text(text, size=35, color='cyan', bg_color='black', font=None, stop_eyes=True)¶ Display simple text
参数: - text (str) – text to be displayed
- size (int, optional) – font size, default is 35
- color (str/tuple, optional) – text color, default is cyan
- bg_color (str/tuple, optional) – background color, the default is black
- font (str, optional) – Font file, Microsoft Yahei is used by default, it includes Chinese and English chars.
-