File: h_group.enaml

package info (click to toggle)
python-enaml 0.19.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,284 kB
  • sloc: python: 31,443; cpp: 4,499; makefile: 140; javascript: 68; lisp: 53; sh: 20
file content (56 lines) | stat: -rw-r--r-- 1,715 bytes parent folder | download
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#------------------------------------------------------------------------------
# Copyright (c) 2014-2024,, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
#------------------------------------------------------------------------------
""" An example of the `HGroup` convenience container.

The HGroup is a convenience container which provides a simple horizontal
group of child widgets, with knobs to control inter-widget spacing, leading
and trailing spacers, and width alignment.

<< autodoc-me >>
"""
from enaml.layout.api import spacer
from enaml.widgets.api import (
    Window, Label, Separator, Field, Form, VGroup, HGroup, CheckBox, SpinBox
)


enamldef Main(Window):
    title = 'HGroup'
    VGroup:
        padding = 0
        spacing = 0
        Form:
            Label:
                text = 'Leading Spacer'
            CheckBox: lsp:
                checked = False
            Label:
                text = 'Trailing Spacer'
            CheckBox: rsp:
                checked = False
            Label:
                text = 'Align Widths'
            CheckBox: wbx:
                checked = True
            Label:
                text = 'Spacing'
            SpinBox: spin:
                value = 10
        Separator:
            pass
        HGroup:
            leading_spacer << spacer(0) if lsp.checked else None
            trailing_spacer << spacer(0) if rsp.checked else None
            spacing << spin.value
            align_widths << wbx.checked
            Field:
                pass
            Field:
                pass
            Field:
                pass