New submission from Arif Zaman <arifza...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue11611>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to