File: resize_waffle.py

package info (click to toggle)
python-guizero 1.1.1%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,676 kB
  • sloc: python: 6,286; makefile: 28; sh: 17
file content (23 lines) | stat: -rw-r--r-- 618 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from guizero import App, Box, Waffle, Slider, Text

def change_dim(slider):
    print("Changing size to {}x{} ".format(g_width.value, g_height.value))
    grid.resize(g_width.value, g_height.value)

app = App("Changing size")

grid = Waffle(app)

controls = Box(app, layout = "grid")

# Width
width_text = Text(controls, text="Width", grid=[0,0])
g_width = Slider(controls, start=0, end=20, command=change_dim, grid=[1,0])
g_width.value = 4

# Height
height_text = Text(controls, text="Height", grid=[0,1])
g_height = Slider(controls, start=0, end=20, command=change_dim, grid=[1,1])
g_height.value = 4

app.display()