Forwarded from the wxPython list -- for the archives, and to see if 
anyone else has suggestions.

-Chris


-------- Original Message --------
Subject: [wxPython-users] Strange Floatcanvas.ClearAll() behavior.
Date: Tue, 03 Nov 2009 07:04:53 -0800 (PST)
From: orjanp <[email protected]>
Reply-To: [email protected]
To: wxPython-users <[email protected]>


I have a strange issue with Floatcanvas.

I have the following code, this is not a complete example, since the
codebase is to big to be posted here:

[code]
        def arrange_shapes_in_order(self, obj):
                """"""
                # Get the current canvas.
                canv = self.p2.GetPage(self.p2.GetSelection())
                print canv

                canv.ClearAll()

                print canv.HitDict # this is now empty.

                # Add all shapes to the canvas.
                for item in obj.objects: # there are two objects. So this is 
done
twice.
                        print '--', item.object
                        canv.AddObject(item.object)
                        item.object.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, 
self.evt_object_hit)
                        print canv._DrawList # Have two objects when done.
                        print canv.HitDict # After the last run, this should 
have both
objects, but only have the last one.

                canv.Draw(True)
[/code]

This will give the following printout. The HitDict print should have
two objects, but it only have the last one. Why?

If I remove the canv.ClearAll() and add canv._DrawList = [],
canv.HitDict = None, it works just fine. The I get the second output,
which is correct.
A complete example that works just fine even with the ClearAll()
function used is found at http://www.copypastecode.com/13778/ , have
not been able to duplicate the strange behavior I have, so there must
be something in my code that make the Bind call overwrite the list
instead of add to it. But what. Any ideas?

[code]
<wx.lib.floatcanvas.FloatCanvas.FloatCanvas; proxy of <Swig Object of
type 'wxPanel *' at 0x1e19920> >
None
-- <builder_defaults.MovingBitmap instance at 0x1a3a440>
[<builder_defaults.MovingBitmap instance at 0x1a3a440>]
{10315: {(0, 0, 1): <builder_defaults.MovingBitmap instance at
0x1a3a440>}, 10316: {}, 10317: {}, 10318: {}, 10319: {}, 10320: {},
10321: {}, 10322: {}, 10323: {}, 10326: {}, 10327: {}}
-- <builder_defaults.MovingBitmap instance at 0x1a3a5f0>
[<builder_defaults.MovingBitmap instance at 0x1a3a440>,
<builder_defaults.MovingBitmap instance at 0x1a3a5f0>]
{10315: {(0, 0, 1): <builder_defaults.MovingBitmap instance at
0x1a3a5f0>}, 10316: {}, 10317: {}, 10318: {}, 10319: {}, 10320: {},
10321: {}, 10322: {}, 10323: {}, 10326: {}, 10327: {}}
[/code]

[code]
<wx.lib.floatcanvas.FloatCanvas.FloatCanvas; proxy of <Swig Object of
type 'wxPanel *' at 0x2939920> >
None
-- <builder_defaults.MovingBitmap instance at 0x262a440>
[<builder_defaults.MovingBitmap instance at 0x262a440>]
{10315: {(0, 0, 1): <builder_defaults.MovingBitmap instance at
0x262a440>}, 10316: {}, 10317: {}, 10318: {}, 10319: {}, 10320: {},
10321: {}, 10322: {}, 10323: {}, 10326: {}, 10327: {}}
-- <builder_defaults.MovingBitmap instance at 0x262a5f0>
[<builder_defaults.MovingBitmap instance at 0x262a440>,
<builder_defaults.MovingBitmap instance at 0x262a5f0>]
{10315: {(0, 0, 1): <builder_defaults.MovingBitmap instance at
0x262a440>, (0, 0, 2): <builder_defaults.MovingBitmap instance at
0x262a5f0>}, 10316: {}, 10317: {}, 10318: {}, 10319: {}, 10320: {},
10321: {}, 10322: {}, 10323: {}, 10326: {}, 10327: {}}
[/code]

--~--~---------~--~----~------------~-------~--~----~
To unsubscribe, send email to [email protected]
or visit http://groups.google.com/group/wxPython-users?hl=en
-~----------~----~----~----~------~----~------~--~---


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[email protected]
_______________________________________________
FloatCanvas mailing list
[email protected]
http://paulmcnett.com/cgi-bin/mailman/listinfo/floatcanvas

Reply via email to