Repository: enthought/chaco

Issue:
ValueError: Handler.init() must return True or False, but instead returned None. when running chaco/chaco/examples/demo/basic/image_from_file.py
**Problem Description**
When running chaco/chaco/examples/demo/basic/image_from_file.py demo, ValueError: Handler.init() must return True or False, but instead returned None. is raised

**Reproduction Steps:**
```python
python chaco/chaco/examples/demo/basic/image_from_file.py
```

Link: https://github.com/enthought/chaco/blob/main/chaco/examples/demo/basic/image_from_file.py

**Full Stacktrace:**
```
(py311) (base) cyliu@aus552cyliu Documents % python3.11 3.11_test/chaco/chaco/examples/demo/basic/image_from_file.py
/Users/cyliu/Documents/3.11_test/chaco/chaco/examples/demo/basic/image_from_file.py:58: DeprecationWarning: find_resource is deprecated. Use importlib.resources instead.
  image_path = find_resource(
2023-05-02 17:38:36.706 Python[5455:122557] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/2z/kylzj9s92y71cxscmljmpqrh0000gt/T/org.python.python.savedState
Traceback (most recent call last):
  File "/Users/cyliu/Documents/3.11_test/chaco/chaco/examples/demo/basic/image_from_file.py", line 224, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/cyliu/Documents/3.11_test/chaco/chaco/examples/demo/basic/image_from_file.py", line 218, in main
    view.configure_traits()
  File "/Users/cyliu/.venvs/py311/lib/python3.11/site-packages/traits/has_traits.py", line 2164, in configure_traits
    rc = toolkit().view_application(
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/qt/toolkit.py", line 237, in view_application
    return view_application.view_application(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/qt/view_application.py", line 92, in view_application
    return ViewApplication(
           ^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/qt/view_application.py", line 127, in __init__
    self.ui = self.view.ui(
              ^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/view.py", line 457, in ui
    ui.ui(parent, kind)
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/ui.py", line 234, in ui
    self.rebuild(self, parent)
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/qt/toolkit.py", line 168, in ui_live
    ui_live.ui_live(ui, parent)
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/qt/ui_live.py", line 52, in ui_live
    _ui_dialog(ui, parent, BaseDialog.NONMODAL)
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/qt/ui_live.py", line 72, in _ui_dialog
    BaseDialog.display_ui(ui, parent, style)
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/qt/ui_base.py", line 299, in display_ui
    ui.prepare_ui()
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/ui.py", line 404, in prepare_ui
    raise ValueError(
ValueError: Handler.init() must return True or False, but instead returned None.
```

**OS, Python version:** [MacOS, python3.11]
```
Package            Version     Editable project location
------------------ ----------- -----------------------------------------
apptools           5.2.0
attrdict           2.0.1
attrdict3          2.0.2
blosc2             2.0.0
celiagg            2.1.3
certifi            2022.12.7
chaco              5.1.0       /Users/cyliu/Documents/3.11_test/chaco
charset-normalizer 3.1.0
configobj          5.0.8
cPython            0.0.6
Cython             0.29.34
dnspython          2.3.0
enable             5.4.0.dev31 /Users/cyliu/Documents/3.11_test/enable
fonttools          4.39.2
h5py               3.8.0
idna               3.4
joblib             1.2.0
kiwisolver         1.4.4
msgpack            1.0.5
numexpr            2.8.4
numpy              1.24.2
packaging          23.1
pandas             1.5.3
Pillow             9.4.0
pip                23.1
py-cpuinfo         9.0.0
PyAudio            0.2.13
pyface             8.0.0       /Users/cyliu/Documents/3.11_test/pyface
pygarrayimage      1.0
pyglet             2.0.5       /Users/cyliu/Documents/3.11_test/pyglet
Pygments           2.14.0
pymongo            4.3.3
pyparsing          3.0.9
PySide6            6.4.3
PySide6-Addons     6.4.3
PySide6-Essentials 6.4.3
python-dateutil    2.8.2
pythonw            3.0.3
pytz               2023.2
reportlab          3.6.12
requests           2.28.2
scikit-learn       1.2.2
scipy              1.10.1
setuptools         65.6.3
shiboken6          6.4.3
six                1.16.0
tables             3.8.0
threadpoolctl      3.1.0
traits             6.4.1
traitsui           8.0.0.dev0  /Users/cyliu/Documents/3.11_test/traitsui
urllib3            1.26.15
wxPython           4.2.0
```


ValueError: Handler.init() must return True or False, but instead returned None. when running chaco/chaco/examples/demo/basic/image_from_file.py
**Problem Description**
When running chaco/chaco/examples/demo/basic/image_from_file.py demo, ValueError: Handler.init() must return True or False, but instead returned None. is raised

**Reproduction Steps:**
```python
python chaco/chaco/examples/demo/basic/image_from_file.py
```

Link: https://github.com/enthought/chaco/blob/main/chaco/examples/demo/basic/image_from_file.py

**Full Stacktrace:**
```
(py311) (base) cyliu@aus552cyliu Documents % python3.11 3.11_test/chaco/chaco/examples/demo/basic/image_from_file.py
/Users/cyliu/Documents/3.11_test/chaco/chaco/examples/demo/basic/image_from_file.py:58: DeprecationWarning: find_resource is deprecated. Use importlib.resources instead.
  image_path = find_resource(
2023-05-02 17:38:36.706 Python[5455:122557] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/2z/kylzj9s92y71cxscmljmpqrh0000gt/T/org.python.python.savedState
Traceback (most recent call last):
  File "/Users/cyliu/Documents/3.11_test/chaco/chaco/examples/demo/basic/image_from_file.py", line 224, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/cyliu/Documents/3.11_test/chaco/chaco/examples/demo/basic/image_from_file.py", line 218, in main
    view.configure_traits()
  File "/Users/cyliu/.venvs/py311/lib/python3.11/site-packages/traits/has_traits.py", line 2164, in configure_traits
    rc = toolkit().view_application(
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/qt/toolkit.py", line 237, in view_application
    return view_application.view_application(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/qt/view_application.py", line 92, in view_application
    return ViewApplication(
           ^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/qt/view_application.py", line 127, in __init__
    self.ui = self.view.ui(
              ^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/view.py", line 457, in ui
    ui.ui(parent, kind)
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/ui.py", line 234, in ui
    self.rebuild(self, parent)
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/qt/toolkit.py", line 168, in ui_live
    ui_live.ui_live(ui, parent)
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/qt/ui_live.py", line 52, in ui_live
    _ui_dialog(ui, parent, BaseDialog.NONMODAL)
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/qt/ui_live.py", line 72, in _ui_dialog
    BaseDialog.display_ui(ui, parent, style)
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/qt/ui_base.py", line 299, in display_ui
    ui.prepare_ui()
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/ui.py", line 404, in prepare_ui
    raise ValueError(
ValueError: Handler.init() must return True or False, but instead returned None.
```

**OS, Python version:** [MacOS, python3.11]
```
Package            Version     Editable project location
------------------ ----------- -----------------------------------------
apptools           5.2.0
attrdict           2.0.1
attrdict3          2.0.2
blosc2             2.0.0
celiagg            2.1.3
certifi            2022.12.7
chaco              5.1.0       /Users/cyliu/Documents/3.11_test/chaco
charset-normalizer 3.1.0
configobj          5.0.8
cPython            0.0.6
Cython             0.29.34
dnspython          2.3.0
enable             5.4.0.dev31 /Users/cyliu/Documents/3.11_test/enable
fonttools          4.39.2
h5py               3.8.0
idna               3.4
joblib             1.2.0
kiwisolver         1.4.4
msgpack            1.0.5
numexpr            2.8.4
numpy              1.24.2
packaging          23.1
pandas             1.5.3
Pillow             9.4.0
pip                23.1
py-cpuinfo         9.0.0
PyAudio            0.2.13
pyface             8.0.0       /Users/cyliu/Documents/3.11_test/pyface
pygarrayimage      1.0
pyglet             2.0.5       /Users/cyliu/Documents/3.11_test/pyglet
Pygments           2.14.0
pymongo            4.3.3
pyparsing          3.0.9
PySide6            6.4.3
PySide6-Addons     6.4.3
PySide6-Essentials 6.4.3
python-dateutil    2.8.2
pythonw            3.0.3
pytz               2023.2
reportlab          3.6.12
requests           2.28.2
scikit-learn       1.2.2
scipy              1.10.1
setuptools         65.6.3
shiboken6          6.4.3
six                1.16.0
tables             3.8.0
threadpoolctl      3.1.0
traits             6.4.1
traitsui           8.0.0.dev0  /Users/cyliu/Documents/3.11_test/traitsui
urllib3            1.26.15
wxPython           4.2.0
```




Discussion:
The problem seems to come from: https://github.com/enthought/traitsui/blob/main/traitsui/ui.py 
The traitsui update requires the init to return a boolean that indicating whether the ui initiation has succeeded or failed. This demo has failed to adapt to this change
The problem seems to come from: https://github.com/enthought/traitsui/blob/main/traitsui/ui.py 
The traitsui update requires the init to return a boolean that indicating whether the ui initiation has succeeded or failed. This demo has failed to adapt to this change

Resolving patch:
diff --git a/chaco/examples/demo/basic/image_from_file.py b/chaco/examples/demo/basic/image_from_file.py
--- a/chaco/examples/demo/basic/image_from_file.py
+++ b/chaco/examples/demo/basic/image_from_file.py
@@ -183,6 +183,7 @@ def init(self, info):
         Overridden here to assign the 'view' trait.
         """
         self.view = info.object
+        return True
 
     def save(self, ui_info):
         """


Test patch: