Skip to content

Commit 213521d

Browse files
committed
going for v0.3.0
1 parent f0bcf13 commit 213521d

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

dumbdisplay/_ddlayer.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,15 @@ def margin(self, left, top = None, right = None, bottom = None):
9393
self.dd._sendCommand(self.layer_id, "margin", str(left), str(top), str(right), str(bottom))
9494
def noMargin(self):
9595
self.dd._sendCommand(self.layer_id, "margin")
96-
def backgroundColor(self, color):
97-
self.dd._sendCommand(self.layer_id, "bgcolor", _DD_COLOR_ARG(color))
96+
def backgroundColor(self, color, opacity = 100):
97+
'''
98+
:param opacity: background opacity (0 - 100)
99+
:return:
100+
'''
101+
if opacity < 100:
102+
self.dd._sendCommand(self.layer_id, "bgcolor", _DD_COLOR_ARG(color), str(opacity))
103+
else:
104+
self.dd._sendCommand(self.layer_id, "bgcolor", _DD_COLOR_ARG(color))
98105
def noBackgroundColor(self):
99106
self.dd._sendCommand(self.layer_id, "nobgcolor")
100107
def clear(self):

samples/neopixels/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ def ShowNeoPixels(*pixels):
109109

110110
r_7seg_layer = Layer7SegmentRow(dd,2)
111111
r_7seg_layer.border(10, "black")
112-
r_7seg_layer.noBackgroundColor()
112+
r_7seg_layer.backgroundColor("white", 50)
113113

114114
g_7seg_layer = Layer7SegmentRow(dd,2)
115115
g_7seg_layer.border(10, "black")
116-
g_7seg_layer.noBackgroundColor()
116+
g_7seg_layer.backgroundColor("white", 50)
117117

118118
b_7seg_layer = Layer7SegmentRow(dd,2)
119119
b_7seg_layer.border(10, "black")
120-
b_7seg_layer.noBackgroundColor()
120+
b_7seg_layer.backgroundColor("white", 50)
121121

122122
# create a graphical layer (LayerGraphical) to show the color set using the following sliders
123123
color_layer = LayerGraphical(dd, 255, 255)

0 commit comments

Comments
 (0)