msl.qt.widgets.led module¶
An LED
widget.
- class msl.qt.widgets.led.Shapes(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
Shapes that are available to draw the
LED
.- Circle = 0¶
- Rounded = 1¶
- Square = 2¶
- Triangle = 3¶
- class msl.qt.widgets.led.LED(*, parent=None, shape=Shapes.Circle, on_color='#0F6900', off_color='grey', clickable=False, tooltip=None)[source]¶
Bases:
QWidget
This class is based off of the QLed project.
- Parameters:
parent (
QtWidgets.QWidget
) – The parent widget.shape (
int
,str
orShapes
) – The shape to draw theLED
. If astr
then the name of one of theShapes
, e.g.0
,'circle'
andShapes.Circle
are equivalent.on_color – The color when the
LED
is on. Seeto_qcolor()
for details about the different data types that are supported.off_color – The color when the
LED
is off. Seeto_qcolor()
for details about the different data types that are supported.clickable (
bool
) – Whether the state of theLED
can be changed by clicking on it.
Example
To view an example with the
LED
run:>>> from msl.examples.qt import led >>> led.show()
- Circle = 0¶
- Rounded = 1¶
- Square = 2¶
- Triangle = 3¶
- clicked¶
Emitted when the LED is clicked (even if it is not clickable).
- toggled¶
Emitted when the LED turns on \(\rightarrow\) off or off \(\rightarrow\) on.
- set_clickable(clickable)[source]¶
Set if the on/off state of the
LED
can be changed by clicking on it.
- off_color()[source]¶
Get the color of the
LED
when it is off.- Returns:
QtGui.QColor
– The off color.
- set_off_color(color)[source]¶
Set the color of the
LED
when it is off.- Parameters:
color – The color when the
LED
is off. Seeto_qcolor()
for details about the different data types that are supported.
- on_color()[source]¶
Get the color of the
LED
when it is on.- Returns:
QtGui.QColor
– The on color.
- set_on_color(color)[source]¶
Set the color of the
LED
when it is on.- Parameters:
color – The color when the
LED
is on. Seeto_qcolor()
for details about the different data types that are supported.