tests/gridlayout.py
changeset 19 5e78d52ebb24
parent 6 d4ee152d7d07
equal deleted inserted replaced
18:e6c3a5ee91aa 19:5e78d52ebb24
     1 #!/usr/bin/env python3
     1 #!/usr/bin/env python3
     2 # -*- coding: utf-8 -*-
     2 # -*- coding: utf-8 -*-
     3 
     3 
     4 from tuikit import *
     4 import sys
       
     5 sys.path.append('..')
       
     6 
       
     7 from tuikit import Container, Size, Widget, GridLayout
     5 
     8 
     6 # -------------
     9 # -------------
     7 # | 0 | 1 | 2 |
    10 # | 0 | 1 | 2 |
     8 # -------------
    11 # -------------
     9 # | 3     | 4 |
    12 # | 3     | 4 |
    20     w = [None] * 6
    23     w = [None] * 6
    21     for i in range(6):
    24     for i in range(6):
    22         w[i] = Widget()
    25         w[i] = Widget()
    23         cont.add(w[i])
    26         cont.add(w[i])
    24 
    27 
    25     w[3].layouthints['colspan'] = 2
    28     w[3].hints['colspan'] = 2
    26 
    29 
    27     w[1].sizemin = (2,2)
    30     w[1].sizemin = Size(2,2)
    28     w[3].sizemin = (6,1)
    31     w[3].sizemin = Size(6,1)
    29 
    32 
    30     grid = GridLayout(3)
    33     grid = GridLayout(3)
    31     grid.container = cont
    34     grid.container = cont
    32 
    35 
    33     print('* _fillgrid')
    36     print('* _fillgrid')
    50         for col in row:
    53         for col in row:
    51             w = col['widget']
    54             w = col['widget']
    52             if w is None:
    55             if w is None:
    53                 print('[0,0]', end=' ')
    56                 print('[0,0]', end=' ')
    54             else:
    57             else:
    55                 print('[%d,%d]' % w.sizemin, end=' ')
    58                 print('[{0.w},{0.h}]'.format(w.sizemin), end=' ')
    56         print()
    59         print()
    57 
    60 
    58     print('colminw:')
    61     print('colminw:')
    59     print(grid._colminw)
    62     print(grid._colminw)
    60 
    63 
    61     print('rowminh:')
    64     print('rowminh:')
    62     print(grid._rowminh)
    65     print(grid._rowminh)
       
    66