nanome.api.ui.button module

class Button(text=None, icon=None)[source]

Bases: nanome._internal.ui.models._Button, nanome.api.ui.ui_base.UIBase

Represents a clickable button on a menu
class ButtonIcon[source]

Bases: nanome._internal.ui.models._ButtonIcon

active
Whether or not the icon is visible
Type:bool
color
The color of the image by button state.
Type:MultiStateVariable
position
The position of the icon
A position of (1, 1, 1) represents right, top, front,
whereas (0, 0, 0) represents the middle.
Type:tuple <float, float, float>
ratio
The ratio of height to height + width for the icon.
A size of 0.5 represents equal width and height
Type:float
rotation
The rotation of the icon about each axis.
A position of (90, 90, 90) represents a quarter rotation
about each of the X, Y and Z axes, whereas (0, 0, 0) represents no rotation.
Type:tuple <float, float, float>
sharpness
The sharpness of the icon image (between 0 and 1)
Type:float
size
The size of the icon image
A size of 1 represents the full size.
Type:float
value
The file paths to the icon image by button state.
Type:MultiStateVariable
class ButtonMesh[source]

Bases: nanome._internal.ui.models._ButtonMesh

active
Whether or not the mesh is visible
Type:bool
color
The color of the mesh by button state
Type:MultiStateVariable
enabled
Whether or not the mesh is visible by button state
Type:MultiStateVariable
class ButtonOutline[source]

Bases: nanome._internal.ui.models._ButtonOutline

active
Whether or not the outline is visible
Type:bool
color
size
The line thickness of the outline by button state
Type:MultiStateVariable
class ButtonSwitch[source]

Bases: nanome._internal.ui.models._ButtonSwitch

active
Whether or not the button is visible
Type:bool
off_color
The color for the button when it is off
Type:Color
on_color
The color for the button when it is on
Type:Color
class ButtonText[source]

Bases: nanome._internal.ui.models._ButtonText

active
Whether or not the button text is visible
Type:bool
auto_size
Whether or not to automatically scale the font size of the text
based on the size of the button
Type:bool
bold
Whether or not the text is bold by button state
Type:MultiStateVariable
color
The color of the text by button state
Type:MultiStateVariable
ellipsis
Whether or not to use an ellipsis if there is too much text to display
Type:bool
horizontal_align
The horizontal alignment of the text
Type:HorizAlignOptions
line_spacing
The space between lines of text
Type:float
max_size
The maximum font size the text will display
This is the upper bound for auto sizing.
Type:float
min_size
The minimum font size the text will display
This is the lower bound for auto sizing.
Type:float
padding_bottom
The padding below the text
Type:float
padding_left
The padding to the left of the text
Type:float
padding_right
The padding to the right of the text
Type:float
padding_top
The padding above the text
Type:float
size
The font size of the text displayed
Type:float
underlined
Whether or not the button text is underlined.
Type:bool
value
The text displayed by button state
Type:MultiStateVariable
vertical_align
The vertical alignment of the text
Type:VertAlignOptions
class ButtonTooltip[source]

Bases: nanome._internal.ui.models._ButtonTooltip

bounds
The bounds of the tooltip
Type:tuple <float, float, float>
content
The main textual content of the tooltip
Type:str
positioning_origin
Determines which part of the tooltip is closest to the button (target)
Refers to the tooltip
Type:ToolTipPositioning
positioning_target
Determines which side of the button the tooltip (origin) will appear on
Refers to the tooltip’s button
Type:ToolTipPositioning
title
The title of the tooltip
Type:str
class HorizAlignOptions

Bases: enum.IntEnum

Horizontal alignment modes for text.
To be used with ui.Label().text_horizontal_align and ui.Button().horizontal_align
Left = 0
Middle = 1
Right = 2
class MultiStateVariable(default=None)[source]

Bases: nanome._internal.ui.models._MultiStateVariable

highlighted
Represents the highlighted state where the element is being hovered
Type:Any
idle
Represents the idle state where the element is not being hovered and is not selected
Type:Any
selected
Represents the highlighted state where the element has been selected
Type:Any
selected_highlighted
Represents the selected, highlighted state where the element has been selected and is being hovered over
Type:Any
set_all(value)[source]
Sets the value for every state
set_each(idle=None, selected=None, highlighted=None, selected_highlighted=None, unusable=None, default=None)[source]
Sets the value for each state
unusable
Represents the unusable state where the element cannot be interacted with
Type:Any
class VertAlignOptions

Bases: enum.IntEnum

Vertical alignment modes for text.
To be used with ui.Label().text_vertical_align and ui.Button().vertical_align
Bottom = 2
Middle = 1
Top = 0
disable_on_press
Whether or not to disable the button after it has been pressed once.
Type:bool
name
The name of the button
Type:str
register_hover_callback(func)[source]
Registers a function to be called when the button is hovered over
Parameters:func (method (Button) -> None) – called when a button is hovered over
register_pressed_callback(func)[source]
Registers a function to be called when the button is pressed/clicked
Parameters:func (method (Button) -> None) – called when a button is pressed
selected
Whether or not the button is selected
Corresponds to a potentially visually distinct UI state
Type:bool
toggle_on_press
Whether or not to toggle the selected state of the button when it is pressed.
Type:bool
unusable
Whether or not the button is unusable
Corresponds to a potentially visually distinct UI state
Type:bool