UI

Provides functionality for drawing and interacting with in-game user interface elements.

stock_canvas: UI.Canvas

The stock UI canvas.

Attribute:

Read-only, cannot be set

Return type:

UI.Canvas

static add_canvas()

Add a new canvas.

Return type:

UI.Canvas

Note

If you want to add UI elements to KSPs stock UI canvas, use UI.stock_canvas.

static message(content[, duration = 1.0][, position = 1][, color = (1.0, 0.92, 0.016)][, size = 20.0])

Display a message on the screen.

Parameters:
  • content (string) – Message content.

  • duration (number) – Duration before the message disappears, in seconds.

  • position (UI.MessagePosition) – Position to display the message.

  • color (Tuple) – The color of the message.

  • size (number) – Size of the message, differs per position.

Note

The message appears just like a stock message, for example quicksave or quickload messages.

static clear([client_only = False])

Remove all user interface elements.

Parameters:

client_only (boolean) – If true, only remove objects created by the calling client.

class UI.MessagePosition

Message position.

top_left

Top left.

top_center

Top center.

top_right

Top right.

bottom_center

Bottom center.