DSGamepadChooser

class wpilib.DSGamepadChooser(*args, **kwargs)

Bases: pybind11_object

A set of selectable options controlled by a Gamepad.

The D-pad up and down buttons select which selectable is active. The D-pad left and right buttons change the selected option in the active selectable.

Overloaded function.

  1. __init__(self: wpilib._wpilib.DSGamepadChooser, port: typing.SupportsInt | typing.SupportsIndex) -> None

Constructs a DSGamepadChooser.

Parameters:

port – The port index on the Driver Station that the gamepad is plugged into (0-5).

  1. __init__(self: wpilib._wpilib.DSGamepadChooser, gamepad: wpilib._wpilib.Gamepad) -> None

Constructs a DSGamepadChooser.

Parameters:

gamepad – The gamepad used to change selections.

class GamepadSelectable

Bases: pybind11_object

A single named set of selectable string options.

get_name() str

Gets the selectable name.

Returns:

selectable name

get_options() list[str]

Gets the available options.

Returns:

available options

get_selected() str

Gets the currently selected option.

Returns:

the currently selected option

get_selected_index() int

Gets the currently selected option index.

Returns:

the currently selected option index

add_double_options(name: str, min: SupportsFloat | SupportsIndex, max: SupportsFloat | SupportsIndex, delta: SupportsFloat | SupportsIndex) wpilib._wpilib.DSGamepadChooser.GamepadSelectable

Adds a selectable with floating point options from min to max, inclusive, stepping by delta.

The first option is selected by default.

Parameters:
  • name – selectable name

  • min – minimum option

  • max – maximum option

  • delta – amount between options

Returns:

the created selectable

add_integer_options(name: str, min: SupportsInt | SupportsIndex, max: SupportsInt | SupportsIndex, delta: SupportsInt | SupportsIndex) wpilib._wpilib.DSGamepadChooser.GamepadSelectable

Adds a selectable with integer options from min to max, inclusive, stepping by delta.

The first option is selected by default.

Parameters:
  • name – selectable name

  • min – minimum option

  • max – maximum option

  • delta – amount between options

Returns:

the created selectable

add_options(name: str, options: collections.abc.Sequence[str]) wpilib._wpilib.DSGamepadChooser.GamepadSelectable

Adds a selectable with the given options.

The first option is selected by default.

Parameters:
  • name – selectable name

  • options – available options

Returns:

the created selectable

get_gamepad() wpilib._wpilib.Gamepad

Get the gamepad used to change selections.

Returns:

the gamepad

get_selectable_names() list[str]

Gets the names of all selectables.

Returns:

selectable names

get_selected(name: str) str

Gets the currently selected option for a selectable.

Parameters:

name – selectable name

Returns:

the currently selected option

get_selected_double(name: str) float

Gets the currently selected double option for a selectable.

Parameters:

name – selectable name

Returns:

the currently selected option

get_selected_index(name: str) int

Gets the currently selected option index for a selectable.

Parameters:

name – selectable name

Returns:

the currently selected option index

get_selected_integer(name: str) int

Gets the currently selected integer option for a selectable.

Parameters:

name – selectable name

Returns:

the currently selected option

get_selected_selectable() wpilib._wpilib.DSGamepadChooser.GamepadSelectable

Gets the selectable currently controlled by D-pad left and right.

Returns:

the selected selectable, or nullptr if no selectable exists

update() None

Updates selectable selection and adds the current selections to the driver station display.

The D-pad up and down buttons select which selectable is active. The D-pad left and right buttons change the selected option in the active selectable.

Call DriverStationDisplay::UpdateLines() externally to flush display updates.