Ejemplo n.º 1
0
    x = randint(0, 7)
    y = randint(0, 7)
    r = randint(0, rs.get())
    g = randint(0, gs.get())
    b = randint(0, bs.get())
    return x, y, r, g, b


def update_display():
    while True:
        sense.set_pixel(*values())


low = 1
high = 255

Text(app, "R", grid=[0, 0])
rs = Slider(app, start=low, end=high, grid=[1, 0], horizontal=False)
rs.set(high)
Text(app, "G", grid=[0, 1])
gs = Slider(app, start=low, end=high, grid=[1, 1], horizontal=False)
gs.set(high)
Text(app, "B", grid=[0, 2])
bs = Slider(app, start=low, end=high, grid=[1, 2], horizontal=False)
bs.set(high)

t = Thread(target=update_display)
t.start()

app.display()
Ejemplo n.º 2
0
Text(window, grid=[2, 0])  # Filler

Text(window, text="\nDesired Temperature: ", align="right", grid=[3, 1])
sldDesiredTemperature = Slider(window,
                               command=handler,
                               start=65,
                               end=80,
                               grid=[3, 2])

Text(window, grid=[4, 0])  # Filler

Text(window, text="\nDead Band: ", align="right", grid=[5, 1])
sldDeadBand = Slider(window, command=handler, start=0, end=2, grid=[5, 2])

Text(window, size=20, grid=[6, 0])  # Filler

Text(window, text="Action: ", align="right", grid=[7, 1])
txtAction = Text(window, grid=[7, 2])

Text(window, grid=[8, 0])  # Filler

PushButton(window, text="QUIT", command=quit, grid=[9, 2])

# Initial conditions
sldRoomTemperature.set(75)
sldDesiredTemperature.set(75)
sldDeadBand.set(1)

window.display()