author | Radek Brich <radek.brich@devl.cz> |
Sun, 22 Feb 2015 09:53:13 +0100 | |
changeset 119 | dd91747504dd |
parent 118 | 8c7970520632 |
permissions | -rwxr-xr-x |
115
b4ff7392003a
GridLayout: basic implementation.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
1 |
#!/usr/bin/env python3 |
b4ff7392003a
GridLayout: basic implementation.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
2 |
|
b4ff7392003a
GridLayout: basic implementation.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
3 |
from tuikit.layouts.grid import GridLayout |
b4ff7392003a
GridLayout: basic implementation.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
4 |
from tuikit.widgets.label import Label |
b4ff7392003a
GridLayout: basic implementation.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
5 |
|
b4ff7392003a
GridLayout: basic implementation.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
6 |
l1 = Label('Hello') |
b4ff7392003a
GridLayout: basic implementation.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
7 |
l1.sizemin.update(10, 1) |
b4ff7392003a
GridLayout: basic implementation.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
8 |
|
b4ff7392003a
GridLayout: basic implementation.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
9 |
grid = GridLayout() |
b4ff7392003a
GridLayout: basic implementation.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
10 |
grid.add(l1, 1, 1) |
b4ff7392003a
GridLayout: basic implementation.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
11 |
grid.update(10, 10) |
b4ff7392003a
GridLayout: basic implementation.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
12 |
|
b4ff7392003a
GridLayout: basic implementation.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
13 |
print(grid._grid_size) |
b4ff7392003a
GridLayout: basic implementation.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
14 |
print(grid._grid) |
b4ff7392003a
GridLayout: basic implementation.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
15 |
|
b4ff7392003a
GridLayout: basic implementation.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
16 |
for row in range(grid.row_count): |
b4ff7392003a
GridLayout: basic implementation.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
17 |
for col in range(grid.column_count): |
b4ff7392003a
GridLayout: basic implementation.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
18 |
w = grid.get_widget_at(row, col) |
b4ff7392003a
GridLayout: basic implementation.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
19 |
name = w.name if w else '--' |
b4ff7392003a
GridLayout: basic implementation.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
20 |
print(name.center(16), end='') |
b4ff7392003a
GridLayout: basic implementation.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
21 |
print() |
b4ff7392003a
GridLayout: basic implementation.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
22 |
|
b4ff7392003a
GridLayout: basic implementation.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
23 |
print(l1.pos) |
b4ff7392003a
GridLayout: basic implementation.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
24 |
print(l1.size) |