LogoLogo
TRIK StudioTRIKLego EV3Lego NXT
English
English
  • TRIK help
  • TRIK Studio
    • About TRIK Studio
      • How to find out the version of TRIK Studio
    • Getting started and creating a project
    • TRIK Studio interface
      • TRIK Studio main menu
      • Working with graphs
      • How to open robot settings
      • How to change TRIK Studio interface language
    • TRIK Studio settings
    • 2D model
      • 2D model tuning
      • Adding restrictions to the 2D Model
        • Restrictions setting examples
    • Visual programming
      • Adding and removing blocks
      • Common blocks
      • Links between blocks
      • Syntax of expressions in the blocks
        • TRIK Studio language types
          • Array
        • TRIK Studio language tokens
        • TRIK Studio language operators
        • Constants
        • Sensor variables
        • Built-in functions
      • Property editing
      • Subprograms
    • Textual programming
    • Exercises
    • External tools
      • PuTTY
      • WinSCP
    • TRIK Studio shortcuts
    • Antivirus conflicts
      • Avast antivirus blocks TRIK Studio. What to do?
  • TRIK Studio Junior
    • About TRIK Studio Junior
      • How to find out the version of TRIK Studio Junior
    • Getting started and creating a project in TRIK Studio Junior
    • TRIK Studio Junior interface
      • How do I replace the "Character movement" image?
    • TRIK Studio Junior settings
    • Visual programming in TRIK Studio Junior
      • Adding and removing blocks in TRIK Studio Junior
      • Blocks in TRIK Studio Junior
      • Links between blocks in TRIK Studio Junior
      • Syntax of expressions in the blocks in TRIK Studio Junior
      • Property editing in TRIK Studio Junior
      • Subprograms in TRIK Studio Junior
    • Exercises in TRIK Studio Junior
  • INTEGRATIONS
    • PyCharm
      • Running a 2D model in TRIK Studio from PyCharm
    • Sublime Text
      • Running a 2D model in TRIK Studio from Sublime Text
      • Uploading programs to several TRIK robots from Sublime Text
    • VSCode
      • Running a 2D model in TRIK Studio from VSCode
      • Uploading programs to several TRIK robots from VSCode
  • TRIK controller
    • About the TRIK controller
      • Screenshot of the TRIK controller screen
    • TRIK controller firmware
      • How to find out the firmware version of the TRIK controller?
    • TRIK controller menu
    • Connecting to the TRIK controller via Wi-Fi
      • Connecting the TRIK controller to a computer and smartphone
      • Connecting the TRIK controller to TRIK Studio
      • Interaction of TRIK controllers
        • An example of solving a problem on the interaction of two robots
    • Connecting to the TRIK controller using UART
    • Launching and uploading programs to the TRIK controller
    • Programming TRIK with the visual programming language
      • TRIK specific blocks
      • Sensory variables for the TRIK controller
    • TRIK controller programming in Python and JavaScript
      • Object «brick»
        • Class «accelerometer»
        • Class «battery»
        • Class «colorSensor»
        • Class «display»
        • Class «encoder»
        • Class «gyroscope»
        • Class «keys»
        • Class «led»
        • Class «lineSensor»
        • Class «motor»
        • Class «objectSensor»
        • Class «sensor»
      • Object «script»
      • Object «mailbox»
      • Object «gamepad»
      • Object «Threading»
      • Function getPhoto
      • Function include
    • TRIK controller web interface
    • Connecting devices to TRIK and working with them
      • Connecting and working with the video module
      • Testing devices connected to the TRIK controller
      • Configuring the operation of a USB camera with a TRIK controller
      • Capturing images with TRIK camera and using them in TRIK Studio
      • Working with battery and charger
  • LEGO EV3 Controller
    • About LEGO EV3
    • Connecting a LEGO EV3 Controller to TRIK Studio
    • LEGO EV3 specific blocks
    • Sensory Variables for the LEGO EV3 Controller
    • Launching and uploading programs to the LEGO EV3
  • LEGO NXT Controller
    • About LEGO NXT
    • LEGO NXT Controller Firmware
    • Connecting a LEGO NXT Controller to TRIK Studio
    • LEGO NXT specific blocks
    • Sensory Variables for the LEGO NXT Controller
    • LEGO NXT C Programming
    • Launching and uploading programs to the LEGO NXT
  • Quadcopter Geoscan Pioneer
    • About quadcopter Geoscan Pioneer
    • Geoscan Pioneer specific blocks
  • TRIK Gamepad
    • About TRIK Gamepad
      • TRIK Gamepad App
      • TRIK Gamepad Utility
    • Robot control from the remote control
  • Feedback
    • Actions in case of TRIK Studio or TRIK controller malfunction
    • Ask a Question
    • trikset.com
Powered by GitBook
On this page
  • addLabel
  • clear
  • drawArc
  • drawEllipse
  • drawLine
  • drawPoint
  • drawRect
  • hide
  • redraw
  • removeLabels
  • setBackground
  • setPainterColor
  • setPainterWidth
  • show
  • showImage

Was this helpful?

Export as PDF
  1. TRIK controller
  2. TRIK controller programming in Python and JavaScript
  3. Object «brick»

Class «display»

This article is automatically translated from Russian by Google Translator.

Provides access to the display of the robot.

Screen size: 240*320 pixels.

Method

Description

Print the specified text on the screen, starting from the specified coordinate.

Clear the drawing window.

Draw an arc of an ellipse inscribed into a rectangle with the upper left corner at specified coordinates and having a given width and height.

Draw an ellipse inscribed into a rectangle with the upper left corner at specified coordinates and having a given width and height.

Draw a line with the beginning and the end at the given coordinates.

Draw a point at given coordinates.

Draw a rectangle with the upper left corner at the specified coordinates and having the specified width and height.

Close and clear the drawing window.

Redraw the window to draw. The changes to the display will only happen after this method is called.

Remove from the screen all text added to it by calls to the "addLabel" method.

Set the screen background to the color you specify.

Set the color of the brush used to draw the graphical primitives.

Set the thickness of the brush used to draw the graphical primitives, in pixels.

Display the image generated in the one-dimensional array on the controller.

Display the image previously loaded on the robot.

addLabel

Print the specified text on the screen, starting from the specified coordinate. If there was already text in the specified coordinates, it will be replaced by the new text.

brick.display().addLabel("text", x, y);
brick.display().addLabel("text", x, y);

Parameters:

  • text — display text,

  • x, y — screen coordinates.

Example

brick.display().addLabel('Hello, world!', 1, 1);
brick.display().addLabel('Hello, world!', 1, 1);

clear

Clear the drawing window.

brick.display().clear();
brick.display().clear();

drawArc

brick.display().drawArc(x, y, l, h, from, to);
brick.display().drawArc(x, y, l, h, from, to);

Parameters:

  • x, y — the coordinates of the upper left corner of the rectangle on the screen,

  • l — rectangle width,

  • h — rectangle height,

  • from — initial angle bounding the arc,

  • to — finite angle bounding the arc.

Example

brick.display().drawArc(0, 0, 10, 10, 20, 50);
brick.display().drawArc(0, 0, 10, 10, 20, 50);

drawEllipse

brick.display().drawEllipse(x, y, l, h);
brick.display().drawEllipse(x, y, l, h);

Parameters:

  • x, y — coordinates of the upper left corner of the rectangle,

  • l — rectangle width,

  • h — rectangle height.

Example

brick.display().drawEllipse(0, 0, 10, 10);
brick.display().drawEllipse(0, 0, 10, 10);

drawLine

brick.display().drawLine(x0, y0, x1, y1);
brick.display().drawLine(x0, y0, x1, y1);

Parameters:

  • x0, y0 — line origin coordinates,

  • x1, y1 — line end coordinates.

Example

brick.display().drawLine(0, 0, 10, 10);
brick.display().drawLine(0, 0, 10, 10);

drawPoint

brick.display().drawPoint(x, y);
brick.display().drawPoint(x, y);

Parameters:

  • point coordinates x, y.

Example

brick.display().drawPoint(10, 10);
brick.display().drawPoint(10, 10);

drawRect

brick.display().drawRect(x, y, l, h);
brick.display().drawRect(x, y, l, h);

Parameters:

  • x, y — coordinates of the upper left corner of the rectangle,

  • l — rectangle width,

  • h — rectangle height.

Example

brick.display().drawRect(0, 0, 10, 10);
brick.display().drawRect(0, 0, 10, 10);

hide

Close and clear the drawing window.

brick.display().hide();
brick.display().hide();

redraw

Redraw the window to draw. The changes to the display will only happen after this method is called.

brick.display().redraw();
brick.display().redraw();

removeLabels

brick.display().removeLabels();
brick.display().removeLabels();

setBackground

Set the screen background to the color you specify.

Available colors:

  • white,

  • red, darkRed,

  • green, darkGreen,

  • blue, darkBlue,

  • cyan, darkCyan,

  • magenta, darkMagenta,

  • yellow, darkYellow,

  • gray, darkGray, lightGray,

  • black.

brick.display().setBackground("color");
brick.display().setBackground("color");

As a parameter, you must specify the color.

Example

brick.display().setBackground("red");
brick.display().setBackground("red");

setPainterColor

Set the color of the brush used to draw the graphical primitives.

Available colors:

  • white,

  • red, darkRed,

  • green, darkGreen,

  • blue, darkBlue,

  • cyan, darkCyan,

  • magenta, darkMagenta,

  • yellow, darkYellow,

  • gray, darkGray, lightGray,

  • black.

brick.display().setPainterColor("color");
brick.display().setPainterColor("color");

As a parameter, you must specify the color.

Example

brick.display().setPainterColor("red");
brick.display().setPainterColor("red");

setPainterWidth

Set the thickness of the brush used to draw the graphical primitives, in pixels.

brick.display().setPainterWidth(d);
brick.display().setPainterWidth(d);

As a parameter, you must specify the thickness d.

Example

brick.display().setPainterWidth(5);
brick.display().setPainterWidth(5);

show

Display the image generated in the one-dimensional array on the controller.

brick.display().show(array, width, height, format)
brick.display().show(array, width, height, format)

Parameters:

  • array — a one-dimensional integer array with dimensions width×height

  • width и height — the width and height of the image, respectively

  • The format in which each element of the array is represented should be passed as the format parameter. The formats currently supported are: «rgb32», «grayscale8», «rgb888».

Example

//rgb32
var photo = getPhoto();
brick.display().show(photo, 160, 120, "rgb32");
script.wait(5000);

//rgb888
pic = []
photo = getPhoto();
l = photo.length;
for (i = 0; i < l; i++) {
    var p = photo[i];
    pic.push((p&0xff0000)>>16);
    pic.push((p&0xff00)>>8);
    pic.push((p&0xff));
}
brick.display().show(pic, 160, 120, "rgb888");
script.wait(5000);                            

//grayscale8                                   
pic = []                                      
photo = getPhoto();
l = photo.length;                             
for (i = 0; i < l; i++) {                     
        var p = photo[i];                     
        pic.push(((p&0xff0000)>>18) + ((p&0xff00)>>10) + ((p&0xff)>>2));                
}                                             
                                              
brick.display().show(pic, 160, 120, "grayscale8");
script.wait(5000);
#rgb32
photo = getPhoto();
brick.display().show(photo, 160, 120, "rgb32");
script.wait(5000);

#rgb888
pic = []
photo = getPhoto();
l = len(photo);
for i in range(l):
    p = photo[i];
    pic.append((p&0xff0000)>>16);
    pic.append((p&0xff00)>>8);
    pic.append((p&0xff));

brick.display().show(pic, 160, 120, "rgb888");
script.wait(5000);                            

#grayscale8                                   
pic = []                                      
photo = getPhoto();
l = len(photo);                             
for i in range(l):                    
    p = photo[i];                     
    pic.append(((p&0xff0000)>>18) + ((p&0xff00)>>10) + ((p&0xff)>>2));                
                                         
                                              
brick.display().show(pic, 160, 120, "grayscale8");
script.wait(5000);

showImage

Display the image previously loaded on the robot.

brick.display().showImage("imagePath");
brick.display().showImage("imagePath");

The name of the image file (in BMP, GIF, JPG, JPEG, PNG, PBM, PGM, PPM, TIFF, XBM, XPM formats) must be specified as a parameter, the path is specified either as absolute or relative to the trik folder.

Example

brick.display().showImage("media/trik_smile_sad.png");
brick.display().showImage("media/trik_smile_sad.png");
PreviousClass «colorSensor»NextClass «encoder»

Last updated 4 years ago

Was this helpful?

The changes on the display will occur only after calling the method "".

Draw an arc of an ellipse inscribed into a rectangle with the upper left corner at specified coordinates and having a given width and height. The changes on the display will occur only after calling the method "".

Draw an ellipse inscribed into a rectangle with the upper left corner at specified coordinates and having a given width and height. The changes on the display will occur only after calling the method "".

Draw a line with the beginning and the end at the given coordinates. The changes on the display will occur only after calling the method "".

Draw a point at given coordinates. The changes on the display will occur only after calling the method "".

Draw a rectangle with the upper left corner at the specified coordinates and having the specified width and height. The changes on the display will occur only after calling the method "".

Remove from the screen all text added to it by calls to the "" method.

Examples of using show() on an image taken with.

getPhoto()
redraw
redraw
redraw
redraw
redraw
redraw
addLabel
addLabel
clear
drawArc
drawEllipse
drawLine
drawPoint
drawRect
hide
redraw
removeLabels
setBackground
setPainterColor
setPainterWidth
show
showImage