diff options
author | kotfu <kotfu@kotfu.net> | 2020-02-05 20:56:29 -0700 |
---|---|---|
committer | kotfu <kotfu@kotfu.net> | 2020-02-05 20:56:29 -0700 |
commit | 7476c27e95b6a9c1ee1c93893d678012c019cf7c (patch) | |
tree | 469fb2f21d78de458f80f276bda0d6f8a73fe554 /examples | |
parent | 58500cb0b86e8046b49aac5d554a6fa9630c0cd3 (diff) | |
download | cmd2-git-7476c27e95b6a9c1ee1c93893d678012c019cf7c.tar.gz |
Documentation updates
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/environment.py | 10 |
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): |