安慰#

介绍#

VEXcode AIM 控制台显示在 VEXcode 的“监控”窗口中。它允许您实时显示文本、接收输入并格式化打印数据。以下是与控制台交互的可用方法列表:

操作 – 输出文本或清除控制台。

  • print – Outputs text to the Console.

  • clear_console – Clears all text from the Console.

Getter – 读取用户输入。

  • input – Returns the most recent user input as a string.

Mutator – 格式化打印文本。

行动#

print#

print 将指定的文本输出到控制台,并默认将光标移动到下一行。

用法:
print(string, end)

范围

描述

string

将作为字符串打印的文本。

end

可选。添加到打印文本末尾的字符串。指定为 end=。默认值:end="\n",表示自动隐藏并将光标移动到下一行。

# 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 清除控制台中的所有文本。

用法:
clear_console()

参数

描述

该方法没有参数。

# Display text then clear it after two seconds
print("I will be cleared!")
wait(2, SECONDS)
clear_console()

盖特#

input#

input 以字符串形式返回控制台中最新的用户输入。

用法:
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 设置所有后续控制台文本的颜色。

用法:
set_console_text_color(color)

范围

描述

color

要设置的颜色:
BLACKBLUECYANGREENORANGEPURPLEREDTRANSPARENTWHITEYELLOW

# Display a green message on the Console
set_console_text_color(GREEN)
print("I am green!")