from guizero import App, Slider, Picture def resize(): picture.width = width.value picture.height = height.value app = App(layout="grid", width=550, height=200) picture = Picture(app, image="guizero.gif", grid=[0, 1]) width = Slider(app, command=resize, grid=[0, 0], start=1, end=picture.width) width.width = picture.width width.value = picture.width height = Slider(app, command=resize, horizontal=False, grid=[1, 1], start=1, end=picture.height) height.height = picture.height height.value = picture.height app.display()
from guizero import App, TextBox, Text, Slider, PushButton, Picture, Combo, CheckBox, ButtonGroup, Box app = App(title="different sizes", width=700, height=700) text = Text(app, "lets change some sizes") text.width = 30 text.height = 2 text_box = TextBox(app, "some text") text_box.width = 50 slider = Slider(app) slider.width = 300 slider.height = 30 button = PushButton(app) button.width = 20 button.height = 2 pic = Picture(app, image="guizero.gif") pic.width = 400 pic.height = 50 combo = Combo(app, ["martin", "laura", "rik"]) combo.width = 50 combo.height = 2 check = CheckBox(app, "tick me") check.width = 17 check.height = 2
btn2 = PushButton(myApp, text="Button_2", command=btn2Push, grid=[1, 3]) btn3 = PushButton(myApp, text="Button_3", command=btn3Push, grid=[1, 4]) btn4 = PushButton(myApp, text="Button_4", command=btn4Push, grid=[1, 5]) Text(myApp, text="Light Sensor", size=12, grid=[5, 0]) Text(myApp, text="light", size=12, grid=[5, 1]) btnLight = PushButton(myApp, image=here + "/sun.png", command=lightSense, grid=[5, 2]) Text(myApp, text="Temperature Sensor", size=12, grid=[6, 0]) Text(myApp, text="temp", size=12, grid=[6, 1]) tempSlide = Slider(myApp, start=150, end=-50, horizontal=False, grid=[6, 2, 1, 4]) tempSlide.width = 50 tempSlide.height = 150 Text(myApp, text="Speaker", align="bottom", size=12, grid=[5, 4]) Text(myApp, text="buzz", align="bottom", size=12, grid=[5, 5]) buzzerPIC = Picture(myApp, image=here + "/speaker.png", grid=[5, 6]) Thread(target=myApp.repeat( 500, readServerValues)).start() # originally 500 miliseconds Thread(target=myApp.repeat(500, sendServerValues)).start() myApp.display()