File: container.py

package info (click to toggle)
python-traitsui 8.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 18,232 kB
  • sloc: python: 58,982; makefile: 113
file content (49 lines) | stat: -rw-r--r-- 896 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
# container.py

from traits.api import CInt, Enum, HasTraits, Instance, String
from traitsui.api import Item, View


class Camera(HasTraits):
    """Camera object"""

    gain = Enum(
        1,
        2,
        3,
        desc="the gain index of the camera",
        label="gain",
    )

    exposure = CInt(
        10,
        desc="the exposure time, in ms",
        label="Exposure",
    )


class Display(HasTraits):
    string = String()

    view = View(Item('string', show_label=False, springy=True, style='custom'))


class Container(HasTraits):
    camera = Instance(Camera, ())
    display = Instance(Display, ())

    view = View(
        Item(
            'camera',
            style='custom',
            show_label=False,
        ),
        Item(
            'display',
            style='custom',
            show_label=False,
        ),
    )


Container().configure_traits()