Οθόνη#

Εισαγωγή#

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

Από προεπιλογή, η γραμματοσειρά για εκτύπωση στο Brain είναι monospaced small η οποία έχει 12 γραμμές και 48 στήλες.

Για το σχέδιο, η ανάλυση του Brain είναι 480 x 240 pixel.

Η οθόνη V5 Brain με κόκκινες γραμμές πλέγματος που δείχνουν τη διάταξη 12 γραμμών και 48 στηλών συνολικά. Οι διαστάσεις των pixel είναι 479 πλάτος επί 239 ύψος. Η επάνω αριστερή γωνία ξεκινά από (0,0) pixel και τη σειρά 1, στήλη 1, ενώ η κάτω δεξιά γωνία καταλήγει στα (479, 239) pixel και τη σειρά 12, στήλη 48.

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

Εκτύπωση δρομέα — Τοποθέτηση και εκτύπωση κειμένου.

  • 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.

  • row — Returns the row where text will be printed.

  • column — Returns the column where text will be printed.

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

  • get_string_width — Returns the width of a string in pixels using the current font.

  • get_string_height — Returns the height of a string in pixels using the current font.

  • clear_line — Clears a line of text.

  • new_line — Moves the cursor to a new line.

Μεταλλαγμένοι — Αλλάξτε τις ρυθμίσεις της οθόνης, τα χρώματα και τη συμπεριφορά σχεδίασης.

  • 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.

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

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

Getters — Ελέγξτε την κατάσταση και τη θέση αφής.

  • pressing — Returns whether the screen is being pressed.

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

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

Επανακλήσεις — Απόκριση σε συμβάντα αφής στην οθόνη.

  • pressed — Registers a function to be called when the screen is pressed.

  • released — Registers a function to be called when the screen is released.

For information on constructing a Brain to gain access to the screen methods, see Brain.

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

print#

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

Χρήση:

brain.screen.print(text, sep, precision)

Παράμετροι

Περιγραφή

text

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

sep

Optional. A string to insert between values. This must be written as a keyword argument (sep=). The default is “”.

precision

Optional. The number of decimal places to display when printing simple numbers. This must be written as a keyword argument(precision=). The default is 2.

# Print on the Brain's screen
brain.screen.print("Hello, Robot!")

Ένα στιγμιότυπο οθόνης του V5 Brain που δείχνει την ένδειξη "Hello Robot" τυπωμένη στην οθόνη στην επάνω αριστερή γωνία με λευκό κείμενο.

set_cursor#

set_cursor moves the cursor to a specific row and column on the Brain screen. The next print call will start printing at that location. How many rows and columns can comfortably fit depends on the selected font. With the default monospaced medium font, up to 8 rows and 13 columns can be displayed clearly. Text placed beyond this range may be cut off or become difficult 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 the set_font.

Χρήση:

brain.screen.set_cursor(row, column)

Παράμετροι

Περιγραφή

row

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

column

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

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

Ένα στιγμιότυπο οθόνης του εγκεφάλου V5 που δείχνει τη Γραμμή 3, Στήλη 12, τυπωμένη στο επάνω μέρος κοντά στο κέντρο της οθόνης, σε αυτήν τη θέση.

next_row#

next_row moves the cursor to the next row.

Χρήση:

brain.screen.next_row()

Παράμετροι

Περιγραφή

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

# Print two lines of text on the Brain's screen
brain.screen.print("Line 1")
brain.screen.next_row()
brain.screen.print("Line 2")

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

clear_row#

clear_row clears a single row of text on the Brain screen.

Χρήση:

brain.screen.clear_row(row, color)

Παράμετροι

Περιγραφή

row

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

color

Προαιρετικό. Ένα έγκυρο color, μια δεκαεξαδική τιμή ή μια συμβολοσειρά ιστού.

# Only keep the text on row 1
brain.screen.print("This text stays")
brain.screen.next_row
brain.screen.print("This text disappears")
wait(3, SECONDS)

brain.screen.clear_row()

row#

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

Χρήση:

brain.screen.row()

Παράμετροι

Περιγραφή

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

# Display the cursor's current row
brain.screen.set_cursor(3, 2)
brain.screen.print(brain.screen.row())

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

column#

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

Χρήση:

brain.screen.column()

Παράμετροι

Περιγραφή

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

# Display the cursor's current column
brain.screen.set_cursor(3, 15)
brain.screen.print(brain.screen.column())

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

get_string_width#

get_string_width returns the width of a string in pixels as an integer, using the current font.

Usage:
brain.screen.get_string_width(string)

Παράμετροι

Περιγραφή

string

Η χορδή που θα μετρηθεί.

get_string_height#

get_string_height returns the height of a string in pixels as an integer, using the current font.

Usage:
brain.screen.get_string_height(string)

Παράμετροι

Περιγραφή

string

Η χορδή που θα μετρηθεί.

clear_line#

clear_line clears the current row of text.

Usage: brain.screen.clear_line()

Παράμετροι

Περιγραφή

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

new_line#

new_line moves the cursor to column 1 on the next row on the Brain screen.

Χρήση:

brain.screen.new_line()

Παράμετροι

Περιγραφή

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

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

clear_screen#

clear_screen clears all drawings and text from the Brain screen.

Χρήση:

brain.screen.clear_screen(color)

Παράμετροι

Περιγραφή

color

Optional. A valid color option:

  • Color.RED
  • Color.GREEN
  • Color.BLUE
  • Color.YELLOW
  • Color.ORANGE
  • Color.PURPLE
  • Color.CYAN
  • Color.BLACK (Default)
  • Color.WHITE

# Print VEXcode on the screen
brain.screen.print("VEXcode")
wait(2, SECONDS)
# Clear screen to black
brain.screen.clear_screen()

# Print VEXcode on the screen
brain.screen.print("VEXcode")

# Clear screen to blue using predefined color
brain.screen.clear_screen(Color.BLUE)

Ένα στιγμιότυπο οθόνης της οθόνης V5 Brain με ολόκληρη την εκτυπώσιμη περιοχή σε έντονο μπλε χρώμα.

set_font#

set_font sets the font used for displaying text on the Brain screen. This font will apply to all text printed after this method runs.

Χρήση:

brain.screen.set_font(font)

Παράμετροι

Περιγραφή

font

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

Στιγμιότυπο οθόνης της οθόνης του V5 Brain με αριθμούς και γράμματα τυπωμένα με λευκό χρώμα στην επάνω αριστερή γωνία με γραμματοσειρά MONO 12. Εμφανίζει το AZ σε μία γραμμή, περίπου στο ένα τέταρτο του πλάτους της οθόνης. Στην κάτω αριστερή γωνία διαβάζει 80 στήλες και 20 γραμμές.
FontType.MONO12

Η ίδια εικόνα με την προηγούμενη, με γραμματοσειρά Mono 15. Εμφανίζει το AZ σε μία γραμμή, σχεδόν στο μισό πλάτος της οθόνης. Στην κάτω αριστερή γωνία διαβάζει 68 στήλες και 16 γραμμές.
FontType.MONO15

Η ίδια εικόνα με την προηγούμενη, με γραμματοσειρά Mono 20. Εμφανίζει το AZ σε μία γραμμή, σχεδόν στα δύο τρίτα του πλάτους της οθόνης. Στην κάτω αριστερή γωνία διαβάζει 48 στήλες και 12 γραμμές.
FontType.MONO20

Η ίδια εικόνα με την προηγούμενη, με γραμματοσειρά Mono 30. Εμφανίζει το AZ σε μία γραμμή, σχεδόν σε όλο το πλάτος της οθόνης. Στην κάτω αριστερή γωνία διαβάζει 32 στήλες και 8 γραμμές.
FontType.MONO30

Η ίδια εικόνα με την προηγούμενη, με γραμματοσειρά Mono 40. Εμφανίζει AX σε μία γραμμή, που εκτείνεται σε όλο το πλάτος της οθόνης. Στην κάτω αριστερή γωνία διαβάζει 24 στήλες και 6 γραμμές.
FontType.MONO40

Η ίδια εικόνα με την προηγούμενη, με γραμματοσειρά Mono 60. Εμφανίζει το AP σε μία γραμμή, που εκτείνεται σε όλο το πλάτος της οθόνης. Στο κάτω μέρος έχει 16 στήλες και 4 γραμμές.
FontType.MONO60

Η ίδια εικόνα με την προηγούμενη, με γραμματοσειρά Prop 20. Εμφανίζει το AZ σε μία γραμμή, σχεδόν στα δύο τρίτα του πλάτους της οθόνης. Στην κάτω αριστερή γωνία διαβάζει 48 στήλες και 12 γραμμές.
FontType.PROP20

Η ίδια εικόνα με την προηγούμενη, με γραμματοσειρά Prop 30. Εμφανίζει το AZ σε μία γραμμή, που εκτείνεται σχεδόν σε όλο το πλάτος της οθόνης. Στην κάτω αριστερή γωνία διαβάζει 32 στήλες και 8 γραμμές.
FontType.PROP30

Η ίδια εικόνα με την προηγούμενη, με γραμματοσειρά Prop 40. Εμφανίζει AU σε μία γραμμή, που εκτείνεται σε όλο το πλάτος της οθόνης. Στην κάτω αριστερή γωνία διαβάζει 24 στήλες και 6 γραμμές.
FontType.PROP40

Η ίδια εικόνα με την προηγούμενη, με γραμματοσειρά Prop 60. Εμφανίζει AN σε μία γραμμή, που εκτείνεται σε όλο το πλάτος της οθόνης. Στο κάτω μέρος αναγράφονται 15 στήλες και 4 γραμμές.
FontType.PROP60

# Set the font type to MONO40
brain.screen.set_font(FontType.MONO40)
brain.screen.print("VEX")

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

set_pen_width#

set_pen_width sets the thickness of drawn lines and shape outlines.

Χρήση:

brain.screen.set_pen_width(value)

Παράμετροι

Περιγραφή

value

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

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

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

set_pen_color#

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

Χρήση:

brain.screen.set_pen_color(color)

Παράμετροι

Περιγραφή

color

The pen and font color to use. Options include:

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

# Draw a rectangle with orange borders
brain.screen.set_pen_color(Color.ORANGE)
brain.screen.draw_rectangle(50, 50, 130, 60)

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

set_fill_color#

set_fill_color sets the fill color used when shapes are drawn.

Χρήση:

brain.screen.set_fill_color(color)

Παράμετροι

Περιγραφή

color

The fill color to use. Options include:

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

# Draw a purple rectangle
brain.screen.set_fill_color(Color.PURPLE)
brain.screen.draw_rectangle(50, 130, 100, 60)

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

set_origin#

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

Χρήση:

brain.screen.set_origin(x, y)

Παράμετροι

Περιγραφή

x

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

y

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

Ισοπαλία#

draw_pixel#

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

Χρήση:

brain.screen.draw_pixel(x, y)

Παράμετροι

Περιγραφή

x

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

y

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

# Draw the pixels marking the corners of a square
brain.screen.draw_pixel(250, 100)
brain.screen.draw_pixel(275, 100)
brain.screen.draw_pixel(250, 125)
brain.screen.draw_pixel(275, 125)

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

draw_line#

draw_line draws a line from the first screen coordinate to the second screen coordinate using the current pen width and pen color.

Χρήση:

brain.screen.draw_line(start_x, start_y, end_x, end_y)

Παράμετροι

Περιγραφή

start_x

Η συντεταγμένη x σε pixel της αρχής της γραμμής, από 0 έως 479, που αναφέρεται στην αρχή της οθόνης.

start_y

Η συντεταγμένη y σε pixel της αρχής της γραμμής, από 0 έως 239, που αναφέρεται στην αρχή της οθόνης.

end_x

Η συντεταγμένη x σε pixel του τέλους της γραμμής, από 0 έως 479, που αναφέρεται στην αρχή της οθόνης.

end_y

Η συντεταγμένη y σε pixel του τέλους της γραμμής, από 0 έως 239, που αναφέρεται στην αρχή της οθόνης.

# Draw a line from the top left to bottom right of the screen
brain.screen.draw_line(0, 0, 479, 239)

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

draw_rectangle#

draw_rectangle draws a rectangle using the current pen width, pen color, and fill color, unless the optional color parameter is used.

Χρήση:

brain.screen.draw_rectangle(x, y, width, height, color)

Παράμετροι

Περιγραφή

x

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

y

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

width

Το πλάτος του ορθογωνίου.

height

Το ύψος του ορθογωνίου.

color

Optional. A valid color option:

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

# Draw a rectangle on the screen
brain.screen.draw_rectangle(50, 50, 130, 60)

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

draw_circle#

draw_circle draws a circle using the current pen width, pen color, and fill color, unless the optional color parameter is used.

Χρήση:

brain.screen.draw_circle(x, y, radius, color)

Παράμετροι

Περιγραφή

x

Η συντεταγμένη x σε pixel του κέντρου του κύκλου, από 0 έως 479, που αναφέρεται στην αρχή της οθόνης.

y

Η συντεταγμένη y σε pixel του κέντρου του κύκλου, από 0 έως 239, που αναφέρεται στην αρχή της οθόνης.

radius

Η ακτίνα του κύκλου, σε pixel.

color

Optional. The fill color to use. Options include:

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

# Draw a circle on the screen
brain.screen.draw_circle(120, 120, 40)

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

render#

render enables double buffering for the Brain’s screen. Once called, any drawing commands (like text, shapes, or images) will no longer appear immediately for the rest of the project. Instead, updates will only be shown when render is used again. This allows for smoother and more controlled screen updates, but means nothing will be visible until render is used.

Χρήση:

brain.screen.render()

Παράμετροι

Περιγραφή

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

# Render text after moving
brain.screen.render()
brain.screen.print("Render later...")
drivetrain.drive_for(FORWARD, 100, MM)
drivetrain.turn_for(RIGHT, 90, DEGREES)
brain.screen.render()

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.

Χρήση:

brain.screen.set_clip_region(x, y, width, height)

Παράμετροι

Περιγραφή

x

Η θέση x της επάνω αριστερής γωνίας του ορθογωνίου, που αναφέρεται στην αρχή της οθόνης.

y

Η θέση y της επάνω αριστερής γωνίας του ορθογωνίου, που αναφέρεται στην αρχή της οθόνης.

width

Το πλάτος του ορθογωνίου.

height

Το ύψος του ορθογωνίου.

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

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

Επαφή#

pressing#

pressing returns a Boolean indicating whether the Brain screen is currently being pressed.

  • True - The screen is being pressed.

  • False - The screen is not being pressed.

Χρήση:

brain.screen.pressing()

Παράμετροι

Περιγραφή

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

# Change the screen's color after it's pressed
while not brain.screen.pressing():
    wait(5, MSEC)
brain.screen.set_fill_color(Color.GREEN)
brain.screen.draw_rectangle(0, 0, 479, 239)

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

x_position#

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

Χρήση:

brain.screen.x_position()

Παράμετροι

Περιγραφή

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

# Display a circle where the screen is pressed
while not brain.screen.pressing():
    wait(5, MSEC)
brain.screen.set_fill_color(Color.WHITE)
brain.screen.draw_circle(brain.screen.x_position(), brain.screen.y_position(), 20)

y_position#

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

Χρήση:

brain.screen.y_position()

Παράμετροι

Περιγραφή

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

# Display a circle where the screen is pressed
while not brain.screen.pressing():
    wait(5, MSEC)
brain.screen.set_fill_color(Color.WHITE)
brain.screen.draw_circle(brain.screen.x_position(), brain.screen.y_position(), 20)

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

pressed#

pressed registers a function to be called when the Brain’s Screen is pressed.

Χρήση:

brain.screen.pressed(callback, arg)

Παράμετροι

Περιγραφή

callback

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

arg

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

def my_function():
  brain.screen.print("Screen pressed")

# Call my_function whenever the Brain screen is pressed
brain.screen.pressed(my_function)

released#

released registers a function to be called when the screen is released (touch removed).

Χρήση:

brain.screen.released(callback, arg)

Παράμετροι

Περιγραφή

callback

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

arg

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

def my_function():
  brain.screen.print("Screen released")

# Call my_function whenever the Brain screen is released
brain.screen.released(my_function)