File: interactive.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 (18 lines) | stat: -rw-r--r-- 372 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# interactive.py

from traits.api import HasTraits, Int, Button, observe
from traitsui.api import View, Item, ButtonEditor


class Counter(HasTraits):
    value = Int()
    add_one = Button()

    @observe('add_one')
    def _increment_value(self, event):
        self.value += 1

    view = View('value', Item('add_one', show_label=False))


Counter().configure_traits()