summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/environment.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/examples/environment.py b/examples/environment.py
index fb90838c..a24734f1 100755
--- a/examples/environment.py
+++ b/examples/environment.py
@@ -8,12 +8,16 @@ import cmd2
class EnvironmentApp(cmd2.Cmd):
""" Example cmd2 application. """
- degrees_c = 22
- sunny = False
def __init__(self):
super().__init__()
- self.add_settable(cmd2.Settable('degrees_c', int, 'Temperature in Celsius'))
+ self.degrees_c = 22
+ self.sunny = False
+ self.add_settable(cmd2.Settable('degrees_c',
+ int,
+ 'Temperature in Celsius',
+ onchange_cb=self._onchange_degrees_c
+ ))
self.add_settable(cmd2.Settable('sunny', bool, 'Is it sunny outside?'))
def do_sunbathe(self, arg):