[issue11611] wxPython PropertyGrid Demo error and fix

Arif Zaman report at bugs.python.org
Sat Mar 19 21:37:57 CET 2011


New submission from Arif Zaman <arifzaman at gmail.com>:

In the wxPython Demo the PropertyGrid code has the lines

        #
        # Let's use some simple custom editor
        #
        # NOTE: Editor must be registered *before* adding a property that
        # uses it.
            pg.RegisterEditor(TrivialPropertyEditor)
            pg.RegisterEditor(SampleMultiButtonEditor)
            pg.RegisterEditor(LargeImageEditor)

The first time you look at this demo, it runs. Then if you go to some other demo, and return back to this (in the same session), it tries to register the same editors. Since they are already registered this causes an AssertionError. I fixed it by

        #
        # Let's use some simple custom editor
        #
        # NOTE: Editor must be registered *before* adding a property that
        # uses it.
        try:
            pg.RegisterEditor(TrivialPropertyEditor)
            pg.RegisterEditor(SampleMultiButtonEditor)
            pg.RegisterEditor(LargeImageEditor)
        except AssertionError:
            pass

although I am sure you can probably do better.

PS: This is my first visit to this site, so if I have posted this with some incorrect area, please just let me know kindly.

----------
components: Demos and Tools
messages: 131441
nosy: Arif.Zaman
priority: normal
severity: normal
status: open
title: wxPython PropertyGrid Demo error and fix
type: compile error
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11611>
_______________________________________


More information about the Python-bugs-list mailing list