UI

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

stock_canvas

The stock UI canvas.

Attribute:

Read-only, cannot be set

Return type:

Canvas

static add_canvas()

Add a new canvas.

Return type:

Canvas

Note

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

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

Display a message on the screen.

Parameters:
  • content (str) – Message content.

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

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

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

  • size (float) – 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 (bool) – If true, only remove objects created by the calling client.

class MessagePosition

Message position.

top_left

Top left.

top_center

Top center.

top_right

Top right.

bottom_center

Bottom center.