2. Modules: StreamDeck Devices
2.1. StreamDeck (Abstract Base)
- class StreamDeck.Devices.StreamDeck.DialEventType(value)
Bases:
EnumType of event that has occurred for a Dial.
- class StreamDeck.Devices.StreamDeck.StreamDeck(device: Device)
Bases:
ABCRepresents a physically attached StreamDeck device.
- close() None
Closes the device for input/output.
See also
See
open()for the corresponding open method.
- connected() bool
Indicates if the physical StreamDeck device this instance is attached to is still connected to the host.
- Return type:
bool
- Returns:
True if the deck is still connected, False otherwise.
- deck_type() str
Retrieves the model of Stream Deck.
- Return type:
str
- Returns:
String containing the model name of the StreamDeck device.
- dial_count() int
Retrieves number of physical dials on the attached StreamDeck device.
- Return type:
int
- Returns:
Number of physical dials
- dial_states() list[bool]
Retrieves the current states of the dials (pressed or not) on the Stream Deck
- Return type:
list(bool)
- Returns:
List describing the current states of each of the dials on the device (True if the dial is being pressed, False otherwise).
- abstractmethod get_firmware_version() str
Gets the firmware version of the attached StreamDeck.
- Return type:
str
- Returns:
String containing the firmware version of the attached device.
- abstractmethod get_serial_number() str
Gets the serial number of the attached StreamDeck.
- Return type:
str
- Returns:
String containing the serial number of the attached device.
- id() str
Retrieves the physical ID of the attached StreamDeck. This can be used to differentiate one StreamDeck from another.
- Return type:
str
- Returns:
Identifier for the attached device.
- is_open() bool
Indicates if the StreamDeck device is currently open and ready for use.
- Return type:
bool
- Returns:
True if the deck is open, False otherwise.
- is_touch() bool
Returns whether the Stream Deck can receive touch events
- Return type:
bool
- Returns:
True if the deck can receive touch events, False otherwise
- is_visual() bool
Returns whether the Stream Deck has a visual display output.
- Return type:
bool
- Returns:
True if the deck has a screen, False otherwise.
- key_count() int
Retrieves number of physical buttons on the attached StreamDeck device.
- Return type:
int
- Returns:
Number of physical buttons.
- key_image_format()
Retrieves the image format accepted by the attached StreamDeck device. Images should be given in this format when setting an image on a button.
See also
See
set_key_image()method to update the image displayed on a StreamDeck button.- Return type:
dict()
- Returns:
Dictionary describing the various image parameters (size, image format, image mirroring and rotation).
- key_layout() tuple[int, int]
Retrieves the physical button layout on the attached StreamDeck device.
- Return type:
(int, int)
- Return (rows, columns):
Number of button rows and columns.
- key_states() list[bool]
Retrieves the current states of the buttons on the StreamDeck.
- Return type:
list(bool)
- Returns:
List describing the current states of each of the buttons on the device (True if the button is being pressed, False otherwise).
- open() None
Opens the device for input/output. This must be called prior to setting or retrieving any device state.
See also
See
close()for the corresponding close method.
- product_id() int
Retrieves the product ID attached StreamDeck. This can be used to determine the exact type of attached StreamDeck.
- Return type:
int
- Returns:
Product ID of the attached device.
- abstractmethod reset() None
Resets the StreamDeck, clearing all button images and showing the standby image.
- screen_image_format()
Retrieves the image format accepted by the screen of the Stream Deck. Images should be given in this format when drawing on screen.
See also
See
set_screen_image()method to draw an image on the StreamDeck screen.- Return type:
dict()
- Returns:
Dictionary describing the various image parameters (size, image format).
- abstractmethod set_brightness(percent: int | float) None
Sets the global screen brightness of the StreamDeck, across all the physical buttons.
- Parameters:
percent (int/float) – brightness percent, from [0-100] as an int, or normalized to [0.0-1.0] as a float.
- set_dial_callback(callback: Callable[[_Self, int, DialEventType, bool], None] | None) None
Sets the callback function called each time there is an interaction with a dial on the StreamDeck.
Note
This callback will be fired from an internal reader thread. Ensure that the given callback function is thread-safe.
Note
Only one callback can be registered at one time.
See also
See
set_dial_callback_async()method for a version compatible with Python 3 asyncio asynchronous functions.- Parameters:
callback (function) – Callback function to fire each time a button state changes.
- set_dial_callback_async(async_callback: Callable[[_Self, int, DialEventType, bool], None] | None, loop=None) None
Sets the asynchronous callback function called each time there is an interaction with a dial on the StreamDeck. The given callback should be compatible with Python 3’s asyncio routines.
Note
The asynchronous callback will be fired in a thread-safe manner.
Note
This will override the callback (if any) set by
set_dial_callback().- Parameters:
async_callback (function) – Asynchronous callback function to fire each time a button state changes.
loop (asyncio.loop) – Asyncio loop to dispatch the callback into
- set_key_callback(callback: Callable[[_Self, int, bool], None] | None) None
Sets the callback function called each time a button on the StreamDeck changes state (either pressed, or released).
Note
This callback will be fired from an internal reader thread. Ensure that the given callback function is thread-safe.
Note
Only one callback can be registered at one time.
See also
See
set_key_callback_async()method for a version compatible with Python 3 asyncio asynchronous functions.- Parameters:
callback (function) – Callback function to fire each time a button state changes.
- set_key_callback_async(async_callback: Callable[[_Self, int, bool], None] | None, loop=None)
Sets the asynchronous callback function called each time a button on the StreamDeck changes state (either pressed, or released). The given callback should be compatible with Python 3’s asyncio routines.
Note
The asynchronous callback will be fired in a thread-safe manner.
Note
This will override the callback (if any) set by
set_key_callback().- Parameters:
async_callback (function) – Asynchronous callback function to fire each time a button state changes.
loop (asyncio.loop) – Asyncio loop to dispatch the callback into
- abstractmethod set_key_color(key: int, r: int, g: int, b: int) None
Sets the color of the touch buttons. These buttons are indexed in order after the standard keys.
- Parameters:
key (int) – Index of the button
r (int) – Red value
g (int) – Green value
b (int) – Blue value
- abstractmethod set_key_image(key: int, image: bytes) None
Sets the image of a button on the StreamDeck to the given image. The image being set should be in the correct format for the device, as an enumerable collection of bytes.
See also
See
key_image_format()method for information on the image format accepted by the device.- Parameters:
key (int) – Index of the button whose image is to be updated.
image (enumerable) – Raw data of the image to set on the button. If None, the key will be cleared to a black color.
- set_poll_frequency(hz: int) None
Sets the frequency of the button polling reader thread, determining how often the StreamDeck will be polled for button changes.
A higher frequency will result in a higher CPU usage, but a lower latency between a physical button press and a event from the library.
- Parameters:
hz (int) – Reader thread frequency, in Hz (1-1000).
- abstractmethod set_screen_image(image: bytes) None
Draws an image on the touchless screen of the StreamDeck.
See also
See
screen_image_format()method for information on the image format accepted by the device.- Parameters:
image (enumerable) – Raw data of the image to set on the button. If None, the screen will be cleared.
- set_touchscreen_callback(callback: Callable[[_Self, TouchscreenEventType, Any], None] | None) None
Sets the callback function called each time there is an interaction with a touchscreen on the StreamDeck.
Note
This callback will be fired from an internal reader thread. Ensure that the given callback function is thread-safe.
Note
Only one callback can be registered at one time.
See also
See
set_touchscreen_callback_async()method for a version compatible with Python 3 asyncio asynchronous functions.- Parameters:
callback (function) – Callback function to fire each time a button state changes.
- set_touchscreen_callback_async(async_callback: Callable[[_Self, TouchscreenEventType, Any], None] | None, loop=None) None
Sets the asynchronous callback function called each time there is an interaction with the touchscreen on the StreamDeck. The given callback should be compatible with Python 3’s asyncio routines.
Note
The asynchronous callback will be fired in a thread-safe manner.
Note
This will override the callback (if any) set by
set_touchscreen_callback().- Parameters:
async_callback (function) – Asynchronous callback function to fire each time a button state changes.
loop (asyncio.loop) – Asyncio loop to dispatch the callback into
- abstractmethod set_touchscreen_image(image: bytes, x_pos: int = 0, y_pos: int = 0, width: int = 0, height: int = 0)
Draws an image on the touchscreen in a certain position. The image should be in the correct format for the devices, as an enumerable collection of bytes.
See also
See
touchscreen_image_format()method for information on the image format accepted by the device.- Parameters:
image (enumerable) – Raw data of the image to set on the button. If None, the touchscreen will be cleared.
x_pos (int) – Position on x axis of the image to draw
y_pos (int) – Position on y axis of the image to draw
width (int) – width of the image
height (int) – height of the image
- touch_key_count() int
Retrieves number of touch buttons on the attached StreamDeck device.
- Return type:
int
- Returns:
Number of touch buttons.
- touchscreen_image_format()
Retrieves the image format accepted by the touchscreen of the Stream Deck. Images should be given in this format when drawing on touchscreen.
See also
See
set_touchscreen_image()method to draw an image on the StreamDeck touchscreen.- Return type:
dict()
- Returns:
Dictionary describing the various image parameters (size, image format).
- vendor_id() int
Retrieves the vendor ID attached StreamDeck. This can be used to determine the exact type of attached StreamDeck.
- Return type:
int
- Returns:
Vendor ID of the attached device.
- class StreamDeck.Devices.StreamDeck.TouchscreenEventType(value)
Bases:
EnumType of event that has occurred for a Touchscreen.
2.2. StreamDeck Mini
- class StreamDeck.Devices.StreamDeckMini.StreamDeckMini(device: Device)
Bases:
StreamDeckRepresents a physically attached StreamDeck Mini device.
- get_firmware_version()
Gets the firmware version of the attached StreamDeck.
- Return type:
str
- Returns:
String containing the firmware version of the attached device.
- get_serial_number()
Gets the serial number of the attached StreamDeck.
- Return type:
str
- Returns:
String containing the serial number of the attached device.
- reset()
Resets the StreamDeck, clearing all button images and showing the standby image.
- set_brightness(percent)
Sets the global screen brightness of the StreamDeck, across all the physical buttons.
- Parameters:
percent (int/float) – brightness percent, from [0-100] as an int, or normalized to [0.0-1.0] as a float.
- set_key_color(key, r, g, b)
Sets the color of the touch buttons. These buttons are indexed in order after the standard keys.
- Parameters:
key (int) – Index of the button
r (int) – Red value
g (int) – Green value
b (int) – Blue value
- set_key_image(key, image)
Sets the image of a button on the StreamDeck to the given image. The image being set should be in the correct format for the device, as an enumerable collection of bytes.
See also
See
key_image_format()method for information on the image format accepted by the device.- Parameters:
key (int) – Index of the button whose image is to be updated.
image (enumerable) – Raw data of the image to set on the button. If None, the key will be cleared to a black color.
- set_screen_image(image)
Draws an image on the touchless screen of the StreamDeck.
See also
See
screen_image_format()method for information on the image format accepted by the device.- Parameters:
image (enumerable) – Raw data of the image to set on the button. If None, the screen will be cleared.
- set_touchscreen_image(image, x_pos=0, y_pos=0, width=0, height=0)
Draws an image on the touchscreen in a certain position. The image should be in the correct format for the devices, as an enumerable collection of bytes.
See also
See
touchscreen_image_format()method for information on the image format accepted by the device.- Parameters:
image (enumerable) – Raw data of the image to set on the button. If None, the touchscreen will be cleared.
x_pos (int) – Position on x axis of the image to draw
y_pos (int) – Position on y axis of the image to draw
width (int) – width of the image
height (int) – height of the image
2.3. StreamDeck Neo
- class StreamDeck.Devices.StreamDeckNeo.StreamDeckNeo(device: Device)
Bases:
StreamDeckRepresents a physically attached StreamDeck Neo device.
- get_firmware_version()
Gets the firmware version of the attached StreamDeck.
- Return type:
str
- Returns:
String containing the firmware version of the attached device.
- get_serial_number()
Gets the serial number of the attached StreamDeck.
- Return type:
str
- Returns:
String containing the serial number of the attached device.
- reset()
Resets the StreamDeck, clearing all button images and showing the standby image.
- set_brightness(percent)
Sets the global screen brightness of the StreamDeck, across all the physical buttons.
- Parameters:
percent (int/float) – brightness percent, from [0-100] as an int, or normalized to [0.0-1.0] as a float.
- set_key_color(key, r, g, b)
Sets the color of the touch buttons. These buttons are indexed in order after the standard keys.
- Parameters:
key (int) – Index of the button
r (int) – Red value
g (int) – Green value
b (int) – Blue value
- set_key_image(key, image)
Sets the image of a button on the StreamDeck to the given image. The image being set should be in the correct format for the device, as an enumerable collection of bytes.
See also
See
key_image_format()method for information on the image format accepted by the device.- Parameters:
key (int) – Index of the button whose image is to be updated.
image (enumerable) – Raw data of the image to set on the button. If None, the key will be cleared to a black color.
- set_screen_image(image)
Draws an image on the touchless screen of the StreamDeck.
See also
See
screen_image_format()method for information on the image format accepted by the device.- Parameters:
image (enumerable) – Raw data of the image to set on the button. If None, the screen will be cleared.
- set_touchscreen_image(image, x_pos=0, y_pos=0, width=0, height=0)
Draws an image on the touchscreen in a certain position. The image should be in the correct format for the devices, as an enumerable collection of bytes.
See also
See
touchscreen_image_format()method for information on the image format accepted by the device.- Parameters:
image (enumerable) – Raw data of the image to set on the button. If None, the touchscreen will be cleared.
x_pos (int) – Position on x axis of the image to draw
y_pos (int) – Position on y axis of the image to draw
width (int) – width of the image
height (int) – height of the image
2.4. StreamDeck Original
- class StreamDeck.Devices.StreamDeckOriginal.StreamDeckOriginal(device: Device)
Bases:
StreamDeckRepresents a physically attached StreamDeck Original device.
- get_firmware_version()
Gets the firmware version of the attached StreamDeck.
- Return type:
str
- Returns:
String containing the firmware version of the attached device.
- get_serial_number()
Gets the serial number of the attached StreamDeck.
- Return type:
str
- Returns:
String containing the serial number of the attached device.
- reset()
Resets the StreamDeck, clearing all button images and showing the standby image.
- set_brightness(percent)
Sets the global screen brightness of the StreamDeck, across all the physical buttons.
- Parameters:
percent (int/float) – brightness percent, from [0-100] as an int, or normalized to [0.0-1.0] as a float.
- set_key_color(key, r, g, b)
Sets the color of the touch buttons. These buttons are indexed in order after the standard keys.
- Parameters:
key (int) – Index of the button
r (int) – Red value
g (int) – Green value
b (int) – Blue value
- set_key_image(key, image)
Sets the image of a button on the StreamDeck to the given image. The image being set should be in the correct format for the device, as an enumerable collection of bytes.
See also
See
key_image_format()method for information on the image format accepted by the device.- Parameters:
key (int) – Index of the button whose image is to be updated.
image (enumerable) – Raw data of the image to set on the button. If None, the key will be cleared to a black color.
- set_screen_image(image)
Draws an image on the touchless screen of the StreamDeck.
See also
See
screen_image_format()method for information on the image format accepted by the device.- Parameters:
image (enumerable) – Raw data of the image to set on the button. If None, the screen will be cleared.
- set_touchscreen_image(image, x_pos=0, y_pos=0, width=0, height=0)
Draws an image on the touchscreen in a certain position. The image should be in the correct format for the devices, as an enumerable collection of bytes.
See also
See
touchscreen_image_format()method for information on the image format accepted by the device.- Parameters:
image (enumerable) – Raw data of the image to set on the button. If None, the touchscreen will be cleared.
x_pos (int) – Position on x axis of the image to draw
y_pos (int) – Position on y axis of the image to draw
width (int) – width of the image
height (int) – height of the image
2.5. StreamDeck Pedal
- class StreamDeck.Devices.StreamDeckPedal.StreamDeckPedal(device: Device)
Bases:
StreamDeckRepresents a physically attached StreamDeck Pedal device.
- get_firmware_version()
Gets the firmware version of the attached StreamDeck.
- Return type:
str
- Returns:
String containing the firmware version of the attached device.
- get_serial_number()
Gets the serial number of the attached StreamDeck.
- Return type:
str
- Returns:
String containing the serial number of the attached device.
- reset()
Resets the StreamDeck, clearing all button images and showing the standby image.
- set_brightness(percent)
Sets the global screen brightness of the StreamDeck, across all the physical buttons.
- Parameters:
percent (int/float) – brightness percent, from [0-100] as an int, or normalized to [0.0-1.0] as a float.
- set_key_color(key, r, g, b)
Sets the color of the touch buttons. These buttons are indexed in order after the standard keys.
- Parameters:
key (int) – Index of the button
r (int) – Red value
g (int) – Green value
b (int) – Blue value
- set_key_image(key, image)
Sets the image of a button on the StreamDeck to the given image. The image being set should be in the correct format for the device, as an enumerable collection of bytes.
See also
See
key_image_format()method for information on the image format accepted by the device.- Parameters:
key (int) – Index of the button whose image is to be updated.
image (enumerable) – Raw data of the image to set on the button. If None, the key will be cleared to a black color.
- set_screen_image(image)
Draws an image on the touchless screen of the StreamDeck.
See also
See
screen_image_format()method for information on the image format accepted by the device.- Parameters:
image (enumerable) – Raw data of the image to set on the button. If None, the screen will be cleared.
- set_touchscreen_image(image, x_pos=0, y_pos=0, width=0, height=0)
Draws an image on the touchscreen in a certain position. The image should be in the correct format for the devices, as an enumerable collection of bytes.
See also
See
touchscreen_image_format()method for information on the image format accepted by the device.- Parameters:
image (enumerable) – Raw data of the image to set on the button. If None, the touchscreen will be cleared.
x_pos (int) – Position on x axis of the image to draw
y_pos (int) – Position on y axis of the image to draw
width (int) – width of the image
height (int) – height of the image
2.6. StreamDeck Plus
- class StreamDeck.Devices.StreamDeckPlus.StreamDeckPlus(device: Device)
Bases:
StreamDeck- get_firmware_version()
Gets the firmware version of the attached StreamDeck.
- Return type:
str
- Returns:
String containing the firmware version of the attached device.
- get_serial_number()
Gets the serial number of the attached StreamDeck.
- Return type:
str
- Returns:
String containing the serial number of the attached device.
- reset()
Resets the StreamDeck, clearing all button images and showing the standby image.
- set_brightness(percent)
Sets the global screen brightness of the StreamDeck, across all the physical buttons.
- Parameters:
percent (int/float) – brightness percent, from [0-100] as an int, or normalized to [0.0-1.0] as a float.
- set_key_color(key, r, g, b)
Sets the color of the touch buttons. These buttons are indexed in order after the standard keys.
- Parameters:
key (int) – Index of the button
r (int) – Red value
g (int) – Green value
b (int) – Blue value
- set_key_image(key, image)
Sets the image of a button on the StreamDeck to the given image. The image being set should be in the correct format for the device, as an enumerable collection of bytes.
See also
See
key_image_format()method for information on the image format accepted by the device.- Parameters:
key (int) – Index of the button whose image is to be updated.
image (enumerable) – Raw data of the image to set on the button. If None, the key will be cleared to a black color.
- set_screen_image(image)
Draws an image on the touchless screen of the StreamDeck.
See also
See
screen_image_format()method for information on the image format accepted by the device.- Parameters:
image (enumerable) – Raw data of the image to set on the button. If None, the screen will be cleared.
- set_touchscreen_image(image, x_pos=0, y_pos=0, width=0, height=0)
Draws an image on the touchscreen in a certain position. The image should be in the correct format for the devices, as an enumerable collection of bytes.
See also
See
touchscreen_image_format()method for information on the image format accepted by the device.- Parameters:
image (enumerable) – Raw data of the image to set on the button. If None, the touchscreen will be cleared.
x_pos (int) – Position on x axis of the image to draw
y_pos (int) – Position on y axis of the image to draw
width (int) – width of the image
height (int) – height of the image
2.7. StreamDeck XL
- class StreamDeck.Devices.StreamDeckXL.StreamDeckXL(device: Device)
Bases:
StreamDeckRepresents a physically attached StreamDeck XL device.
- get_firmware_version()
Gets the firmware version of the attached StreamDeck.
- Return type:
str
- Returns:
String containing the firmware version of the attached device.
- get_serial_number()
Gets the serial number of the attached StreamDeck.
- Return type:
str
- Returns:
String containing the serial number of the attached device.
- reset()
Resets the StreamDeck, clearing all button images and showing the standby image.
- set_brightness(percent)
Sets the global screen brightness of the StreamDeck, across all the physical buttons.
- Parameters:
percent (int/float) – brightness percent, from [0-100] as an int, or normalized to [0.0-1.0] as a float.
- set_key_color(key, r, g, b)
Sets the color of the touch buttons. These buttons are indexed in order after the standard keys.
- Parameters:
key (int) – Index of the button
r (int) – Red value
g (int) – Green value
b (int) – Blue value
- set_key_image(key, image)
Sets the image of a button on the StreamDeck to the given image. The image being set should be in the correct format for the device, as an enumerable collection of bytes.
See also
See
key_image_format()method for information on the image format accepted by the device.- Parameters:
key (int) – Index of the button whose image is to be updated.
image (enumerable) – Raw data of the image to set on the button. If None, the key will be cleared to a black color.
- set_screen_image(image)
Draws an image on the touchless screen of the StreamDeck.
See also
See
screen_image_format()method for information on the image format accepted by the device.- Parameters:
image (enumerable) – Raw data of the image to set on the button. If None, the screen will be cleared.
- set_touchscreen_image(image, x_pos=0, y_pos=0, width=0, height=0)
Draws an image on the touchscreen in a certain position. The image should be in the correct format for the devices, as an enumerable collection of bytes.
See also
See
touchscreen_image_format()method for information on the image format accepted by the device.- Parameters:
image (enumerable) – Raw data of the image to set on the button. If None, the touchscreen will be cleared.
x_pos (int) – Position on x axis of the image to draw
y_pos (int) – Position on y axis of the image to draw
width (int) – width of the image
height (int) – height of the image