File: moving_grid.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 (25 lines) | stat: -rw-r--r-- 511 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from guizero import App, Text, PushButton
from random import randint

a = App("dynamically changing grid", layout="grid")
a.text_size = 40
t = []

def dance():
    for l in t:
        x = l.grid[0] - 1
        if x < 0:
            x = 4

        l.grid = (x, l.grid[1])

for x in range(5):
    for y in range(5):
        t.append(Text(a,
            text="{}.{}".format(x,y),
            grid=[x,y],
            color=(randint(100,255), randint(100,255), randint(100,255))))

a.repeat(250, dance)

a.display()