예제 #1
0
# restartButton = PushButton(adminWindow,text='Reset',grid = [4,4], command = restart, args = stream)

# Padding is implemented using empty text boxes (!)
TopGap = Text(control_app, text='', grid=[0, 0])
LGap = Text(control_app, text='', grid=[0, 1])
LGap.width = 5
midGap = Text(control_app, text='', grid=[2, 1])
midGap.width = 5
hGap = Text(control_app, text='', grid=[1, 2])
hGap.height = 3
barPad = Text(control_app, text='', grid=[4, 1])
barPad.width = 3

# bar chart on right hand edge
barChart = Waffle(control_app, height=20, width=1, pad=0, grid=[5, 1, 1, 4])
barChart.repeat(100, updateBar)  # update the bar every 100ms

# Push buttons
#earthquake = PushButton(control_app, text="Earthquake Off",
#                        command=change_earthquake_text, grid=[1, 1])
#earthquake.bg = 'red'
#earthquake.width = 12
#earthquake.height = 3

eqOn = Picture(control_app, 'eqon.gif',grid = [1, 1])
eqOn.hide()
eqOff = Picture(control_app, 'eqoff.gif', grid = [1, 1])
eqOff.show()

#control = PushButton(control_app, text="Control Off",
#                     command=change_control_text, grid=[3, 1])
예제 #2
0
파일: gui.py 프로젝트: Machine-3R/python
gpio = pi.headers['J8'].pins

app = App("GPIO Zero", layout="grid", width=200, height=710)

for n, pin in gpio.items():
    col_1 = n % 2
    x = 0 if col_1 else 3
    y = ceil(n / 2) - 1
    align = 'right' if col_1 else 'left'
    Text(app, str(pin.function), grid=[x, y], align=align)
    x = 1 if col_1 else 2
    color = {
        '5V': 'red',
        '3V3': 'orange',
        'GND': 'black',
    }.get(pin.function, 'white')
    waffle = Waffle(app,
                    height=1,
                    width=1,
                    grid=[x, y],
                    color=color,
                    dotty=True)

    if 'GPIO' in pin.function:
        bcm = int(pin.function[4:])
        mock_pin = Device.pin_factory.pin(bcm)
        waffle.repeat(10, create_update(mock_pin, waffle))
        if mock_pin.function == 'input':
            waffle.update_command(create_callback(mock_pin))

app.display()