Οθόνη#

Εισαγωγή#

Οι μέθοδοι οθόνης ελέγχουν τον τρόπο με τον οποίο το ρομπότ κωδικοποίησης VEX AIM εμφανίζει κείμενο, αριθμούς και γραφικά στην οθόνη του και τον τρόπο με τον οποίο ανταποκρίνεται στα πατήματα της οθόνης.

Παρακάτω είναι μια λίστα με όλες τις μεθόδους:

Αφή – Εντοπισμός και απόκριση σε πατήματα οθόνης.

  • pressing – Returns whether the screen is currently being pressed.

  • x_position – Returns the x-coordinate of the last screen press.

  • y_position – Returns the y-coordinate of the last screen press.

Εκτύπωση δρομέα – Εμφάνιση κειμένου χρησιμοποιώντας σύστημα γραμμών/στηλών.

  • print – Prints text, numbers, or variable values at the current cursor position.

  • set_cursor – Moves the cursor to a specific row and column.

  • next_row – Moves the cursor to column 1 of the next row.

  • clear_row – Clears a row of text.

  • get_row – Returns the current cursor row.

  • get_column – Returns the current cursor column.

Εκτύπωση XY – Εμφάνιση κειμένου σε συγκεκριμένη συντεταγμένη οθόνης.

  • print_at – Prints text, numbers, or variable values at a specific x and y coordinate.

  • set_origin – Sets the origin used for coordinate-based printing and drawing.

Μεταλλαγμένοι – Καθαρίστε την οθόνη ή ενημερώστε τις οπτικές ρυθμίσεις.

  • clear_screen – Clears the screen of all drawings and text.

  • set_font – Sets the font for printed text.

  • set_pen_width – Sets the thickness of drawn lines and shape outlines.

  • set_pen_color – Sets the color of text, pixels, lines, and shape outlines.

  • set_fill_color – Sets the fill color for drawn shapes and printed text backgrounds.

Σχεδίαση – Προσθήκη γραφικών και εικόνων στην οθόνη.

Επανακλήσεις – Εκτέλεση συναρτήσεων όταν πατηθεί ή απελευθερωθεί η οθόνη.

  • pressed – Registers a function to call when the screen is pressed.

  • released – Registers a function to call when the screen is released.

Επαφή#

pressing#

pressing returns a Boolean indicating whether the robot’s screen is currently being pressed.

  • True – The screen is being pressed.

  • False – The screen is not being pressed.

Usage:
robot.screen.pressing()

Παράμετροι

Περιγραφή

Αυτή η μέθοδος δεν έχει παραμέτρους.

# Turn LEDs white only while the screen is pressed.
while True:
    if robot.screen.pressing():
        robot.led.on(ALL_LEDS, WHITE)
    else:
        robot.led.off(ALL_LEDS)

    wait(50, MSEC)

# Display different messages after the screen is pressed
while not robot.screen.pressing():
    wait(5, MSEC)
robot.screen.print("First message!")
robot.screen.next_row()
# Lift finger to press the screen again
while robot.screen.pressing():
    wait(5, MSEC)
while not robot.screen.pressing():
    wait(5, MSEC)
robot.screen.print("Second message!")
robot.screen.next_row()

x_position#

x_position returns the x-coordinate of the last screen press as an integer from 0 (left) to 240 (right).

Usage:
robot.screen.x_position()

Παράμετροι

Περιγραφή

Αυτή η μέθοδος δεν έχει παραμέτρους.

# Display the x-coordinate of where
# the screen is pressed
while True:
    if robot.screen.pressing():
        robot.screen.clear_screen()
        robot.screen.print(robot.screen.x_position())
    wait (50, MSEC)

y_position#

y_position returns the y-coordinate of the last screen press as an integer from 0 (top) to 240 (bottom).

Usage:
robot.screen.y_position()

Παράμετροι

Περιγραφή

Αυτή η μέθοδος δεν έχει παραμέτρους.

# Display the y-coordinate of where
# the screen is pressed
while True:
    if robot.screen.pressing():
        robot.screen.clear_screen()
        robot.screen.print(robot.screen.y_position())
    wait (50, MSEC)

Εκτύπωση δρομέα#

print#

print prints text, numbers, or variable values on the robot’s screen at the current cursor position and font.

Usage:
robot.screen.print(text)

Παράμετροι

Περιγραφή

text

Το κείμενο, ο αριθμός ή η τιμή μεταβλητής που θα εμφανίζεται στην οθόνη.

# Display a message at the starting cursor position
robot.screen.print("Hello, Robot!")

Ένα στιγμιότυπο οθόνης της οθόνης του ρομπότ, με την ένδειξη "Γεια σου, Ρομπότ!" τυπωμένη με λευκό χρώμα στην κορυφή.

set_cursor#

set_cursor moves the text cursor to a specific row and column on the robot’s screen. The next print call will start printing at that location. The number of rows and columns that fit depends on the selected font. With the default monospaced medium font, the screen can clearly display up to 8 rows and 13 columns. Text placed beyond this range may be cut off or harder to read.

Monospaced fonts have characters that are all the same width, making text placement consistent. In contrast, proportional fonts vary in character width, so some letters take up more space than others. However, regardless of which type is used, set_cursor positions the cursor based on row and column size, not font style. The font size can be adjusted using set_font.

Usage:
robot.screen.set_cursor(row, column)

Παράμετροι

Περιγραφή

row

Η γραμμή στην οποία θα μετακινηθεί ο κέρσορας.

column

Η στήλη στην οποία θα μετακινηθεί ο κέρσορας.

# Display text starting at Row 3 Column 2
robot.screen.set_cursor(3, 2)
robot.screen.print("Row 3, Column 2")

Ένα στιγμιότυπο οθόνης της οθόνης του ρομπότ, με την ένδειξη "Γραμμή 3, Στήλη 2" τυπωμένη με λευκό χρώμα ακριβώς πάνω από το κέντρο της οθόνης, ξεκινώντας από τη γραμμή 3, τη στήλη 2.

next_row#

next_row moves the cursor to column 1 on the next row on the robot’s screen.

Usage:
robot.screen.next_row()

Παράμετροι

Περιγραφή

Αυτή η μέθοδος δεν έχει παραμέτρους.

# Display two lines of text
robot.screen.print("Line 1")
robot.screen.next_row()
robot.screen.print("Line 2")

Ένα στιγμιότυπο οθόνης της οθόνης του ρομπότ με λευκό κείμενο. Η οθόνη αναφέρει τη Γραμμή 1 στην επάνω γραμμή, αριστερή στοίχιση και τη Γραμμή 2 ακριβώς από κάτω.

clear_row#

clear_row clears a single row of text on the robot’s screen.

Usage:
robot.screen.clear_row(row, color)

Παράμετρος

Περιγραφή

row

Προαιρετικό. Η γραμμή που θα διαγραφεί ως ακέραιος αριθμός. Η προεπιλογή είναι η τρέχουσα γραμμή του δρομέα.

color

Optional. The color to apply to the cleared row. Options include:

  • BLACK
  • BLUE
  • CYAN
  • GREEN
  • ORANGE
  • PURPLE
  • RED
  • TRANSPARENT
  • WHITE
  • YELLOW
You can also specify a custom color.

# Display text on two rows
robot.screen.print("This text stays")
robot.screen.next_row()
robot.screen.print("This text disappears")

# Wait 3 seconds before clearing only the second row
wait(3, SECONDS)
robot.screen.clear_row()

# Turn the 5th row green
robot.screen.clear_row(5, GREEN)

Ένα στιγμιότυπο οθόνης της οθόνης του ρομπότ με μια πράσινη γραμμή στο κέντρο της οθόνης από αριστερά προς τα δεξιά.

get_row#

get_row returns the current row where text will be printed as an integer.

Usage:
robot.screen.get_row()

Παράμετροι

Περιγραφή

Αυτή η μέθοδος δεν έχει παραμέτρους.

# Set cursor to (3,2) and print row number
robot.screen.set_cursor(3, 2)
robot.screen.print(robot.screen.get_row())

Στιγμιότυπο οθόνης SA της οθόνης του ρομπότ, με ένα λευκό 3 τυπωμένο κοντά στο κέντρο του άνω αριστερού τεταρτημορίου, στη γραμμή 3 στήλη 2.

get_column#

get_column returns the current column where text will be printed as an integer.

Usage:
robot.screen.get_column()

Παράμετροι

Περιγραφή

Αυτή η μέθοδος δεν έχει παραμέτρους.

# Set cursor to (3,2) and print column number
robot.screen.set_cursor(3, 2)
robot.screen.print(robot.screen.get_column())

Ένα στιγμιότυπο οθόνης της οθόνης του ρομπότ, με ένα λευκό 2 τυπωμένο κοντά στο κέντρο του άνω αριστερού τεταρτημορίου, στη σειρά 3 στήλη 2.

Εκτύπωση XY#

set_origin#

set_origin sets the origin used for drawing and coordinate-based printing on the robot’s screen. By default, the origin is the top-left corner of the screen.

Usage:
robot.screen.set_origin(x, y)

Παράμετρος

Περιγραφή

x

Η νέα συντεταγμένη x που θα οριστεί ως αρχή, δίνεται ως ακέραιος αριθμός από 0 έως 240.

y

Η νέα συντεταγμένη y που θα οριστεί ως αρχή, δίνεται ως ακέραιος αριθμός από 0 έως 240.

# Set the origin to the center of the screen
robot.screen.set_origin(120, 120)

# Draw a rectangle at the new origin
robot.screen.draw_rectangle(0, 0, 80, 40)

Ένα στιγμιότυπο οθόνης της οθόνης του ρομπότ με ένα λευκό ορθογώνιο σχεδιασμένο στο κάτω αριστερό τεταρτημόριο. Η επάνω αριστερή γωνία του ορθογωνίου είναι το κέντρο της οθόνης.

Μεταλλάκτες#

clear_screen#

clear_screen clears all drawings and text from the robot’s screen. By default, it also resets the cursor position to row 1, column 1.

Usage:
robot.screen.clear_screen(color)

Παράμετρος

Περιγραφή

color

Optional. Sets the screen color. Options include:

  • BLACK
  • BLUE
  • CYAN
  • GREEN
  • ORANGE
  • PURPLE
  • RED
  • TRANSPARENT
  • WHITE
  • YELLOW
You can also specify a custom color.

# Draw a circle, and clear it after 2 seconds
robot.screen.draw_circle(120, 120, 60)
wait(2, SECONDS)
robot.screen.clear_screen()

# Set the background color of the screen to red
robot.screen.clear_screen(RED)

Ένα στιγμιότυπο οθόνης της οθόνης του ρομπότ, που δείχνει ολόκληρη την οθόνη με έντονο κόκκινο χρώμα.

set_font#

set_font sets the font used for displaying text on the robot’s screen. This font will apply to all text printed with print or print_at. The default font at the start of a project is MONO24.

Usage:
robot.screen.set_font(fontname)

Παράμετρος

Περιγραφή

fontname

Sets the font to one of the following:

  • MONO12
  • MONO15
  • MONO20
  • MONO24
  • MONO30
  • MONO40
  • MONO60
  • PROP20
  • PROP30
  • PROP40
  • PROP60
These options are shown below.

Ένα στιγμιότυπο οθόνης της οθόνης του ρομπότ που δείχνει ένα δείγμα αριθμών και γραμμάτων τυπωμένων σε γραμματοσειρά Mono 12. Το αλφάβητο εκτείνεται σε 1 γραμμή κειμένου. Το κάτω μέρος έχει 26 χαρακτήρες σε όλη την έκταση και 15 γραμμές.
MONO12

Η ίδια εικόνα με την προηγούμενη με γραμματοσειρά Mono 15. Τα γράμματα AT εκτείνονται σε 1 γραμμή κειμένου. Το κάτω μέρος έχει 20 χαρακτήρες σε όλη την επιφάνεια και 12 γραμμές.
MONO15

Η ίδια εικόνα με την προηγούμενη, με γραμματοσειρά Mono 20. Τα γράμματα AP εκτείνονται σε 1 σειρά κειμένου. Το κάτω μέρος έχει 16 χαρακτήρες σε όλη την επιφάνεια και 9 σειρές.
MONO20

Η ίδια εικόνα με την προηγούμενη, με γραμματοσειρά Mono 24. Τα γράμματα AM εκτείνονται σε 1 σειρά κειμένου. Το κάτω μέρος έχει 13 χαρακτήρες κατά μήκος και 8 σειρές.
MONO24

Ίδια εικόνα με την προηγούμενη, με γραμματοσειρά Mono 30. Τα γράμματα AK εκτείνονται σε 1 σειρά κειμένου. Το κάτω μέρος έχει 11 χαρακτήρες κατά μήκος και 6 σειρές.
MONO30

Ίδια εικόνα με την προηγούμενη, με γραμματοσειρά Mono 40. Τα γράμματα AH εκτείνονται σε 1 σειρά κειμένου. Το κάτω μέρος έχει 8 χαρακτήρες κατά μήκος και 5 σειρές.
MONO40

Ίδια εικόνα με την προηγούμενη, με αριθμούς τυπωμένους σε γραμματοσειρά Mono 60. Οι αριθμοί 1-6 εκτείνονται σε 1 σειρά κειμένου. Στο κάτω μέρος αναγράφονται 3 σειρές.
MONO60

Η ίδια εικόνα με την προηγούμενη, με γραμματοσειρά Prop 20. Τα γράμματα As εκτείνονται σε 1 γραμμή κειμένου. Το κάτω μέρος έχει 20 χαρακτήρες σε όλη την έκταση και 9 γραμμές.
PROP20

Ίδια εικόνα με την προηγούμενη, με γραμματοσειρά Prop 30. Τα γράμματα AM εκτείνονται σε 1 σειρά κειμένου. Το κάτω μέρος έχει 15 χαρακτήρες σε όλη την έκταση και 6 σειρές.
PROP30

Ίδια εικόνα με την προηγούμενη, με γραμματοσειρά Prop 40. Τα γράμματα AJ εκτείνονται σε 1 σειρά κειμένου. Το κάτω μέρος έχει 11 χαρακτήρες κατά μήκος και 5 σειρές.
PROP40

Η ίδια εικόνα με την προηγούμενη, με αριθμούς τυπωμένους σε γραμματοσειρά Prop 60. Οι αριθμοί 1-7 εκτείνονται σε 1 σειρά κειμένου. Το κάτω μέρος γράφει 7 επί 3.
PROP60

# Display text using a larger font
robot.screen.set_font(MONO40)
robot.screen.print("VEX")

Ένα στιγμιότυπο οθόνης της οθόνης του ρομπότ γράφει VEX σε γραμματοσειρά Mono 40 στην επάνω αριστερή γωνία.

set_pen_width#

set_pen_width sets the thickness of drawn lines and shape outlines.

Usage:
robot.screen.set_pen_width(width)

Παράμετρος

Περιγραφή

width

Το πλάτος της πένας, σε pixel, κυμαίνεται από 0 έως 32.

# Draw a rectangle with a pen width of 10
robot.screen.set_pen_width(10)
robot.screen.draw_rectangle(50, 50, 130, 60)

Ένα στιγμιότυπο οθόνης της οθόνης του ρομπότ με ένα παχύ λευκό ορθογώνιο σχεδιασμένο στο πάνω μισό.

set_pen_color#

set_pen_color sets the color of text, pixels, lines, and shape outlines.

Usage:
robot.screen.set_pen_color(color)

Παράμετρος

Περιγραφή

color

Optional. The pen and font color to use. Options include:

  • BLACK
  • BLUE
  • CYAN
  • GREEN
  • ORANGE
  • PURPLE
  • RED
  • TRANSPARENT
  • WHITE
  • YELLOW
You can also specify a custom color.

# Draw a rectangle with a red pen
robot.screen.set_pen_color(RED)
robot.screen.draw_rectangle(50, 50, 130, 60)

Ένα στιγμιότυπο οθόνης της οθόνης του ρομπότ με ένα κόκκινο ορθογώνιο με ένα λεπτό περίγραμμα σχεδιασμένο στο πάνω μισό.

set_fill_color#

set_fill_color sets the fill color used when shapes are drawn and when printed text uses a background.

Usage:
robot.screen.set_fill_color(color)

Παράμετρος

Περιγραφή

color

Optional. The fill color to use. Options include:

  • BLACK
  • BLUE
  • CYAN
  • GREEN
  • ORANGE
  • PURPLE
  • RED
  • TRANSPARENT
  • WHITE
  • YELLOW
You can also specify a custom color.

# Draw two orange rectangles
robot.screen.set_fill_color(ORANGE)
robot.screen.draw_rectangle(50, 50, 100, 60)
robot.screen.draw_rectangle(50, 130, 100, 60)

Ένα στιγμιότυπο οθόνης της οθόνης του ρομπότ με δύο παράλληλα πορτοκαλί ορθογώνια με λεπτά, λευκά περιγράμματα τοποθετημένα στο αριστερό κέντρο της οθόνης.

# Display text with a purple background
robot.screen.set_fill_color(PURPLE)
robot.screen.print("Highlight")

Ένα στιγμιότυπο οθόνης της οθόνης του ρομπότ αναφέρει την ένδειξη "Επισήμανση" σε λευκό κείμενο με μια μωβ επισήμανση γύρω της, ξεκινώντας από την επάνω αριστερή γωνία.

Ισοπαλία#

draw_pixel#

draw_pixel draws one pixel at the selected x and y coordinate using the current pen color.

Usage:
robot.screen.draw_pixel(x, y)

Παράμετρος

Περιγραφή

x

Η συντεταγμένη x όπου θα σχεδιαστεί το εικονοστοιχείο, η οποία δίνεται ως ακέραιος αριθμός από 0 έως 240.

y

Η συντεταγμένη y όπου θα σχεδιαστεί το εικονοστοιχείο, η οποία δίνεται ως ακέραιος αριθμός από 0 έως 240.

# Draw a pixel at the center of the screen
robot.screen.draw_pixel(120, 120)

Ένα στιγμιότυπο οθόνης της οθόνης του ρομπότ με ένα μόνο λευκό pixel στο κέντρο.

draw_line#

draw_line draws a line from the first screen coordinate (x1, y1) to the second screen coordinate (x2, y2) using the current pen width and pen color.

The x and y-coordinates use the default origin of (0, 0) unless a different origin has been set using set_origin.

Usage:
robot.screen.draw_line(x1, y1, x2, y2)

Παράμετρος

Περιγραφή

x1

Η αρχική συντεταγμένη x της γραμμής, που δίνεται ως ακέραιος αριθμός από 0 έως 240.

y1

Η αρχική συντεταγμένη y της γραμμής, που δίνεται ως ακέραιος αριθμός από 0 έως 240.

x2

Η τελική συντεταγμένη x της γραμμής, που δίνεται ως ακέραιος αριθμός από 0 έως 240.

y2

Η τελική συντεταγμένη y της γραμμής, η οποία δίνεται ως ακέραιος αριθμός από 0 έως 240.

# Draw a line from the top left to bottom right of the screen
robot.screen.draw_line(0, 0, 240, 240)

Ένα στιγμιότυπο οθόνης της οθόνης του ρομπότ με μια λεπτή λευκή διαγώνια γραμμή που τραβιέται από την επάνω αριστερή γωνία προς την κάτω δεξιά γωνία.

draw_rectangle#

draw_rectangle draws a rectangle with its top-left corner at the selected (x, y) coordinate and a size determined by the given width and height, all measured in pixels. The rectangle’s outline is drawn using the current pen width and pen color. The interior is filled with the current fill color, unless the optional color parameter is used.

The x and y-coordinates use the default origin of (0, 0) unless a different origin has been set using set_origin.

Usage:
robot.screen.draw_rectangle(x, y, width, height, color)

Παράμετρος

Περιγραφή

x

Η συντεταγμένη x της επάνω αριστερής γωνίας του ορθογωνίου, που δίνεται ως ακέραιος αριθμός από 0 έως 240.

y

Η συντεταγμένη y της επάνω αριστερής γωνίας του ορθογωνίου, που δίνεται ως ακέραιος αριθμός από 0 έως 240.

width

Το πλάτος του ορθογωνίου, που δίνεται ως ακέραιος αριθμός από 0 έως 240.

height

Το ύψος του ορθογωνίου, που δίνεται ως ακέραιος αριθμός από 0 έως 240.

color

Optional. The fill color of the rectangle. Options include:

  • BLACK
  • BLUE
  • CYAN
  • GREEN
  • ORANGE
  • PURPLE
  • RED
  • TRANSPARENT
  • WHITE
  • YELLOW
You can also specify a custom color.

# Draw a red rectangle on the screen
robot.screen.draw_rectangle(50, 50, 130, 60, RED)

Ένα στιγμιότυπο οθόνης της οθόνης του ρομπότ με ένα φωτεινό κόκκινο ορθογώνιο με ένα λεπτό λευκό περίγραμμα στο κέντρο του πάνω μισού της οθόνης.

draw_circle#

draw_circle draws a circle with its center at the selected (x, y) coordinate and a size determined by the given radius, all measured in pixels. The circle’s outline is drawn using the current pen width and pen color. The interior is filled with the current fill color, unless the optional color parameter is used.

The x and y-coordinates use the default origin of (0, 0) unless a different origin has been set using set_origin.

Usage:
robot.screen.draw_circle(x, y, radius, color)

Παράμετρος

Περιγραφή

x

Η συντεταγμένη x του κέντρου του κύκλου, που δίνεται ως ακέραιος αριθμός από 0 έως 240.

y

Η συντεταγμένη y του κέντρου του κύκλου, που δίνεται ως ακέραιος αριθμός από 0 έως 240.

radius

Η ακτίνα του κύκλου, που δίνεται ως ακέραιος αριθμός από 0 έως 240 pixel.

color

Optional. The fill color of the circle. Options include:

  • BLACK
  • BLUE
  • CYAN
  • GREEN
  • ORANGE
  • PURPLE
  • RED
  • TRANSPARENT
  • WHITE
  • YELLOW
You can also specify a custom color.

# Draw a green circle on the screen
robot.screen.draw_circle(120, 120, 40, GREEN)

Ένα στιγμιότυπο οθόνης της οθόνης του ρομπότ με έναν φωτεινό πράσινο κύκλο με ένα λεπτό λευκό περίγραμμα στο κέντρο.

show_file#

show_file displays a custom uploaded image on the robot’s screen, with its position set using the x, y, and center parameters based on the image’s reference point.

Usage:
robot.screen.show_file(file, x, y, center)

Παράμετρος

Περιγραφή

file

The custom image to use, from IMAGE1 to IMAGE10. The image number matches the number shown in the AIM control panel.

x

Η οριζόντια μετατόπιση για την εικόνα, που δίνεται ως ακέραιος αριθμός σε pixel. Οι θετικές τιμές την μετακινούν προς τα δεξιά, ενώ οι αρνητικές τιμές την μετακινούν προς τα αριστερά.

y

Η κατακόρυφη μετατόπιση για την εικόνα, που δίνεται ως ακέραιος αριθμός σε pixel. Οι θετικές τιμές την μετακινούν προς τα κάτω, ενώ οι αρνητικές τιμές την μετακινούν προς τα πάνω.

center

Optional. If center=True, the image is placed using its center at coordinate (120, 120). By default (center=False), the top-left corner of the image is used and positioned relative to the current origin.

# Display uploaded Image 1 in the top left corner
robot.screen.show_file(IMAGE1, 0, 0)

# Show the same image on both sides of the screen
# Image size is 120 x 120
robot.screen.show_file(IMAGE1, 65, 0, center=True)
robot.screen.show_file(IMAGE1, -65, 0, center=True)

set_clip_region#

set_clip_region defines a rectangular area on the screen where all drawings and text will be confined. Any content outside this region will not be displayed.

Usage:
robot.screen.set_clip_region(x, y, width, height)

Παράμετρος

Περιγραφή

x

The x-coordinate of the top-left corner of the clip region, given as an decimal (float) from 0 to 240.

y

The y-coordinate of the top-left corner of the clip region, given as an decimal (float) from 0 to 240.

width

The width of the clip region in pixels, given as an decimal (float) from 0 to 240.

height

The height of the clip region in pixels, given as an decimal (float) from 0 to 240.

# Restrict text and drawings to a specific region
robot.screen.set_clip_region(0, 0, 120, 120)
robot.screen.draw_rectangle(60, 60, 100, 100, RED)
robot.screen.print_at("Cut off!", x=60, y=60)

Ένα στιγμιότυπο οθόνης της οθόνης του ρομπότ που δείχνει το κείμενο και την εικόνα που ταιριάζουν στην περιοχή αποκοπής. Στο επάνω αριστερό τεταρτημόριο, το λευκό κείμενο γράφει Cut o, με ένα κόκκινο τετράγωνο ακριβώς από κάτω.

Επανακλήσεις#

pressed#

pressed registers a method to be called when the robot’s screen is pressed.

Usage:
robot.screen.pressed(callback, arg)

Παράμετροι

Περιγραφή

callback

Μια συνάρτηση που έχει οριστεί προηγουμένως για εκτέλεση όταν πατηθεί η οθόνη του ελεγκτή.

arg

Προαιρετικό. Μια πλειάδα που περιέχει ορίσματα για να μεταβιβαστούν στη συνάρτηση επανάκλησης. Δείτε Χρήση Συναρτήσεων με Παραμέτρους για περισσότερες πληροφορίες.

# Set the LEDs to green when the screen is pressed.
def screen_touched():
    robot.led.on(ALL_LEDS, GREEN)

robot.screen.pressed(screen_touched)

released#

released registers a method to be called when the robot’s screen is released.

Usage:
robot.screen.released(callback, arg)

Παράμετροι

Περιγραφή

callback

Μια συνάρτηση που έχει οριστεί προηγουμένως για εκτέλεση όταν πατηθεί η οθόνη του ελεγκτή.

arg

Προαιρετικό. Μια πλειάδα που περιέχει ορίσματα για να μεταβιβαστούν στη συνάρτηση επανάκλησης. Δείτε Χρήση Συναρτήσεων με Παραμέτρους για περισσότερες πληροφορίες.

# Set the LEDs to blue when the screen is released.
def screen_released():
    robot.led.on(ALL_LEDS, BLUE)

robot.screen.released(screen_released)