kivy: KeyError: (3385,) in widget.py
<p>When trying to exectue following code (edited version from the <a href="https://github.com/kivy/kivy-designer" rel="nofollow">kivy-designer</a>, stands under the MIT license):</p>

<pre><code>def __init__(self, **kwargs):
    self._buttons = {}

    super(PlaygroundSizeView, self).__init__(**kwargs)

    for title, values in self.default_sizes:
        grid = StackLayout(orientation="lr-tb", size_hint=(1, None))

        def sort_sizes(item):
            return item[1][1] * item[1][0]

        values = sorted(values, key=sort_sizes, reverse=True)
        for name, size in values:
            btn = ToggleButton(text='', markup=True, size_hint=(0.25, 0.25))
            btntext = ('%s\n[color=777777][size=%d]%dx%d[/size][/color]' %
                       (name, btn.font_size * 0.8, size[0], size[1]))
            btn.text = btntext
            btn.bind(on_press=partial(self.set_size, size))
            grid.add_widget(btn)
            self._buttons[name] = btn

        item = AccordionItem(title=title)
        _sv = ScrollView(do_scroll_x=False)
        _sv.add_widget(grid)
        item.add_widget(_sv)
        self.accordion.add_widget(item)

    self.accordion.select(self.accordion.children[-1])

    self.update_buttons()
</code></pre>

<p>I get following Error 7 times in a row with different numbers before the program stops:</p>

<blockquote>
  <p>Exception ignored in: functools.partial(, 3385)<br>
  Traceback (most recent call last):<br>
    File "E:\Programme(x86)\Python\Kivy Virtual Environment\lib\site-packages\kivy\uix\widget.py", line 239, in _widget_destructor
  KeyError: (3385,)</p>
</blockquote>

<p>It only appeared after I edited the code and added <code>ScrollView</code> at #1. I think it might be that python is trying to garbage collect <code>ScrollView</code> but is somehow unable to.</p>

<p>Linue 239 of widget.py is the <code>del</code> line of following function:</p>

<pre><code>def _widget_destructor(uid, r):
    # Internal method called when a widget is deleted from memory. the only
    # thing we remember about it is its uid. Clear all the associated callbacks
    # created in kv language.
    del _widget_destructors[uid]
    Builder.unbind_widget(uid)
</code></pre>

<p>Thanks a lot in advance!</p>

<p>That line #1 has a typo in add_widget.
Are you sure that add_widget returns the parent widget?
I suggest you make a ScrollView first, then add the grid, then add the item to accordion.</p>

python kivy destructor keyerror