kivy-designer
kivy-designer copied to clipboard
AttributeError: 'NoneType' object has no attribute 'dismiss'
Auto-generated by kivy-designer itself, when trying "Run" after experiencing Issue #357 (that Issue refers to unending "[CRITICAL][Clock ]..." errors to the console immediately after creating project.)
To recreate:
- Create New Project
- Select Run > Run
- Error occurs immediately
(I actually first experienced this when I selected "TabbedPanel" before clicking "Create New Project" -- I wanted to try to run the code to see the different tabs work, and it crashed with the same error. In doing some further checking, I came up with the three-step minimal example for this bug report.)
Environment Info
kivy: 1.10.1.dev0 pygments: 2.2.0 docutils: 0.14 watchdog: 0.8.3 jedi: 0.11.1 gitpython: 2.1.8 six: 1.11.0 kivy-garden: 0.1.4
Platform: Darwin-17.4.0-x86_64-i386-64bit Python: 3.5.3
Traceback
Traceback (most recent call last):
File "/Users/shawley/anaconda/envs/py35/lib/python3.5/site-packages/kivy/core/window/window_sdl2.py", line 723, in mainloop
self._mainloop()
File "/Users/shawley/anaconda/envs/py35/lib/python3.5/site-packages/kivy/core/window/window_sdl2.py", line 460, in _mainloop
EventLoop.idle()
File "/Users/shawley/anaconda/envs/py35/lib/python3.5/site-packages/kivy/base.py", line 340, in idle
self.dispatch_input()
File "/Users/shawley/anaconda/envs/py35/lib/python3.5/site-packages/kivy/base.py", line 325, in dispatch_input
post_dispatch_input(*pop(0))
File "/Users/shawley/anaconda/envs/py35/lib/python3.5/site-packages/kivy/base.py", line 231, in post_dispatch_input
listener.dispatch('on_motion', etype, me)
File "kivy/_event.pyx", line 707, in kivy._event.EventDispatcher.dispatch
File "/Users/shawley/anaconda/envs/py35/lib/python3.5/site-packages/kivy/core/window/__init__.py", line 1349, in on_motion
self.dispatch('on_touch_up', me)
File "kivy/_event.pyx", line 707, in kivy._event.EventDispatcher.dispatch
File "/Users/shawley/anaconda/envs/py35/lib/python3.5/site-packages/kivy/core/window/__init__.py", line 1385, in on_touch_up
if w.dispatch('on_touch_up', touch):
File "kivy/_event.pyx", line 707, in kivy._event.EventDispatcher.dispatch
File "/Users/shawley/anaconda/envs/py35/lib/python3.5/site-packages/kivy/uix/dropdown.py", line 310, in on_touch_up
if super(DropDown, self).on_touch_up(touch):
File "/Users/shawley/anaconda/envs/py35/lib/python3.5/site-packages/kivy/uix/scrollview.py", line 848, in on_touch_up
if self.dispatch('on_scroll_stop', touch):
File "kivy/_event.pyx", line 707, in kivy._event.EventDispatcher.dispatch
File "/Users/shawley/anaconda/envs/py35/lib/python3.5/site-packages/kivy/uix/scrollview.py", line 887, in on_scroll_stop
self.simulate_touch_down(touch)
File "/Users/shawley/anaconda/envs/py35/lib/python3.5/site-packages/kivy/uix/scrollview.py", line 607, in simulate_touch_down
ret = super(ScrollView, self).on_touch_down(touch)
File "/Users/shawley/anaconda/envs/py35/lib/python3.5/site-packages/kivy/uix/widget.py", line 460, in on_touch_down
if child.dispatch('on_touch_down', touch):
File "kivy/_event.pyx", line 707, in kivy._event.EventDispatcher.dispatch
File "/Users/shawley/anaconda/envs/py35/lib/python3.5/site-packages/kivy/uix/widget.py", line 460, in on_touch_down
if child.dispatch('on_touch_down', touch):
File "kivy/_event.pyx", line 707, in kivy._event.EventDispatcher.dispatch
File "/Users/shawley/anaconda/envs/py35/lib/python3.5/site-packages/kivy/uix/behaviors/button.py", line 151, in on_touch_down
self.dispatch('on_press')
File "kivy/_event.pyx", line 707, in kivy._event.EventDispatcher.dispatch
File "/Users/shawley/github/kivy-designer/designer/uix/action_items.py", line 183, in on_press
self.cont_menu.dismiss()
AttributeError: 'NoneType' object has no attribute 'dismiss'
End of Traceback
Noticed that the instructions say
Building To build, and run your project, you’ll need to configure the Kivy Designer Builder. The Builder will help you to target your application to the desired platforms. You can access Builder settings at Run -> Edit Profiles...
but when I do that (click on "Edit Profiles"), it crashes with the exact same error.
You guys are initializing cont_menu as cont_menu = ObjectProperty(None) on line 61 of kivy-designer/designer/uix/action_items.py.
...So I notice on line 158 you preface that call to dismiss() with an if self.cont_menu:.
Why does the earlier call check for None but the one on line 183 doesn't check?
...because adding that check before line 183 resolves this Issue.