fixing weather?
This commit is contained in:
parent
37deb0d01b
commit
9d887930da
@ -56,6 +56,7 @@ class UnicornHat(object):
|
||||
GPIO.output(self.PINS_DAT[0], b1 & 0b10000000)
|
||||
GPIO.output(self.PINS_DAT[1], b2 & 0b10000000)
|
||||
GPIO.output(self.PIN_CLK, GPIO.HIGH)
|
||||
|
||||
b1 <<= 1
|
||||
b2 <<= 1
|
||||
#time.sleep(0.00000001)
|
||||
@ -83,21 +84,19 @@ class UnicornHat(object):
|
||||
def set_pixel(self, x, y, r, g, b):
|
||||
"""Set a single pixel to RGB colour.
|
||||
:param x: Horizontal position from 0 to width
|
||||
:param y: Veritcal position from 0 to height
|
||||
:param y: Vertical position from 0 to height
|
||||
:param r: Amount of red from 0 to 255
|
||||
:param g: Amount of green from 0 to 255
|
||||
:param b: Amount of blue from 0 to 255
|
||||
"""
|
||||
self.buffer[y][x] = r, g, b
|
||||
|
||||
|
||||
def set_matrix(self, matrix):
|
||||
"""Sets a height x width matrix directly"""
|
||||
self.reset_clock()
|
||||
self.buffer = matrix
|
||||
self.show()
|
||||
|
||||
|
||||
def set_pixel_hsv(self, x, y, h, s=1.0, v=1.0):
|
||||
"""set a single pixel to a colour using HSV.
|
||||
:param x: Horizontal position from 0 to 15
|
||||
@ -124,7 +123,6 @@ class UnicornHat(object):
|
||||
|
||||
def get_shape(self):
|
||||
"""Return the shape (width, height) of the display."""
|
||||
|
||||
return self.WIDTH, self.HEIGHT
|
||||
|
||||
def clear(self):
|
||||
|
@ -11,14 +11,14 @@ except ImportError:
|
||||
|
||||
|
||||
class OutputHandler():
|
||||
def __init__(self, width, height):
|
||||
def __init__(self, width, height, primary = [200, 200, 200], secondary = [10, 200, 10], error = [200, 10, 10]):
|
||||
"""width is presumed to be larger than height"""
|
||||
self.width = width
|
||||
self.height = height
|
||||
self.output = HAT.UnicornHat(width, height)
|
||||
self.primary = [200, 200, 200]
|
||||
self.secondary = [10, 200, 10]
|
||||
self.red = [200, 10, 10]
|
||||
self.primary = primary
|
||||
self.secondary = secondary
|
||||
self.red = error
|
||||
|
||||
|
||||
|
||||
|
@ -53,6 +53,7 @@ class ClockFace(object):
|
||||
def set_face(self, weather):
|
||||
""""""
|
||||
self.weather = weather
|
||||
print("WEATHER: ", weather)
|
||||
self.run(self.IO.clock_face,(weather,))
|
||||
|
||||
|
||||
|
@ -10,8 +10,8 @@ app = dash.Dash(__name__, external_stylesheets=ex_css)
|
||||
|
||||
card_main = dbc.Card(
|
||||
[
|
||||
dbc.CardImg(src="/assets/ball_of_sun.jpg", top=True, bottom=False,
|
||||
title="Image by Kevin Dinkel", alt='Learn Dash Bootstrap Card Component'),
|
||||
#dbc.CardImg(src="/assets/ball_of_sun.jpg", top=True, bottom=False,
|
||||
# title="Image by Kevin Dinkel", alt='Learn Dash Bootstrap Card Component'),
|
||||
dbc.CardBody(
|
||||
[
|
||||
html.H4("Learn Dash with Charming Data", className="card-title"),
|
||||
@ -47,9 +47,6 @@ card_question = dbc.Card(
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
today = datetime.date.today().strftime("%d.%m.%Y")
|
||||
tag = ["Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"][datetime.datetime.today().weekday()]
|
||||
|
||||
@ -59,24 +56,24 @@ string_header = tag + ", der " + today
|
||||
app.layout = html.Div([
|
||||
html.Header(children = [
|
||||
html.H1(string_header)
|
||||
]),
|
||||
],),
|
||||
html.Div(
|
||||
className = "content",
|
||||
style = {"padding-top" : "32em"},
|
||||
children = [
|
||||
dbc.Row([dbc.Col(card_main, width=3),
|
||||
dbc.Col(card_question, width=3)], justify="around"), # justify="start", "center", "end", "between", "around"
|
||||
# dbc.Row([dbc.Col(card_main, width=3),
|
||||
# dbc.Col(card_question, width=3)], justify="around"), # justify="start", "center", "end", "between", "around"
|
||||
|
||||
# dbc.CardGroup([card_main, card_question, card_graph]) # attaches cards with equal width and height columns
|
||||
# dbc.CardDeck([card_main, card_question, card_graph]) # same as CardGroup but with gutter in between cards
|
||||
|
||||
# dbc.CardColumns([ # Cards organised into Masonry-like columns
|
||||
# card_main,
|
||||
# card_question,
|
||||
dbc.CardColumns([ # Cards organised into Masonry-like columns
|
||||
card_main,
|
||||
card_question,card_question,card_question,card_question,
|
||||
# card_graph,
|
||||
# card_question,
|
||||
# card_question,
|
||||
# ])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
@ -85,3 +82,4 @@ app.layout = html.Div([
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run_server(host="0.0.0.0")
|
||||
5
|
||||
|
@ -1,4 +1,4 @@
|
||||
header {
|
||||
div.header {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: var(--heading-height);
|
||||
|
Loading…
x
Reference in New Issue
Block a user