Canvas

class UI.Canvas

A canvas for user interface elements. See UI.stock_canvas and UI.add_canvas().

rect_transform: UI.RectTransform

The rect transform for the canvas.

Attribute:

Read-only, cannot be set

Return type:

UI.RectTransform

visible: boolean

Whether the UI object is visible.

Attribute:

Can be read or written

Return type:

boolean

add_panel([visible = True])

Create a new container for user interface elements.

Parameters:

visible (boolean) – Whether the panel is visible.

Return type:

UI.Panel

add_text(content[, visible = True])

Add text to the canvas.

Parameters:
  • content (string) – The text.

  • visible (boolean) – Whether the text is visible.

Return type:

UI.Text

add_input_field([visible = True])

Add an input field to the canvas.

Parameters:

visible (boolean) – Whether the input field is visible.

Return type:

UI.InputField

add_button(content[, visible = True])

Add a button to the canvas.

Parameters:
  • content (string) – The label for the button.

  • visible (boolean) – Whether the button is visible.

Return type:

UI.Button

remove()

Remove the UI object.