UI#
Provides functionality for drawing and interacting with in-game user interface elements.
Note
For drawing 3D objects in the flight scene, see the Drawing service. User interface elements created by a client are removed when that client disconnects, and when the game scene changes. A client that needs its interface in more than one scene must create it again in each of them.
- static add_canvas()#
Add a new canvas.
- Return type:
Note
If you want to add UI elements to KSPs stock UI canvas, use
stock_canvas.
- static message(content[, duration=1.0][, position=MessagePosition.top_center][, color=StdLib.ColorRGBA(1.0, 0.92, 0.016, 1.0)][, size=2e+01])#
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 (StdLib.ColorRGBA) – 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.