安慰#
介绍#
The VEXcode AIM Console is displayed in the Monitor window within VEXcode. It allows you to display text, receive input, and format printed data in real time.
Below is a list of all methods:
Actions — Output text or clear the console.
print— Outputs text to the console.clear_console— Clears all text from the console.
Getter — Read user input.
input— Returns the most recent user input.
Mutator — Format printed text.
set_console_text_color— Sets the color for all subsequent console text.
行动#
print#
print outputs the specified text to the console and moves the cursor to the next line by default.
Usage:
print(string, end)
范围 |
描述 |
|---|---|
|
将作为字符串打印的文本。 |
|
Optional. The string added to the end of the printed text. Specified as |
# Display two messages consecutively
print("I'm printed on one line.")
print("I'm printed automatically on the next line!")
# Print three colors on one line in the Print Console
colors = ["Red", "Green", "Blue"]
for color in colors:
print(color, end=", ")
clear_console#
clear_console clears all text from the console.
Usage:
clear_console()
参数 |
描述 |
|---|---|
该方法没有参数。 |
# Display text then clear it after two seconds
print("I will be cleared!")
wait(2, SECONDS)
clear_console()
盖特#
input#
input returns the most recent user input from the console as a string.
Usage:
input()
参数 |
描述 |
|---|---|
该方法没有参数。 |
# Message the robot a name for the robot to greet
print("What is your name?")
answer = input()
print("Hi, " + answer + "! My name is AIM.")
修改器#
set_console_text_color#
set_console_text_color sets the color for all subsequent console text.
Usage:
set_console_text_color(color)
范围 |
描述 |
|---|---|
|
The color to set:
|
# Display a green message on the Console
set_console_text_color(GREEN)
print("I am green!")