Mark Elston wrote:
Attached is a simple app I have been toying with (a beginning
implementation of the Kakuro puzzle game).Part of the app manages a Grid of bitmaps that contain a set
of numbers. The values displayed will change as the user
interacts with the app so I have implemented this by
recreating the bitmaps appropriately and detaching the
original and inserting the new bitmap in its place.However, when I run it I get very strange behavior. When I
click on a cell the cell doesn't change (though the code
is executing properly). However, if I resize the frame
I see the old bitmap on the background of the frame and the
new bitmap gets moved.
Detaching a widget from the sizer does not destroy the widget because the widget is owned by the parent window, not the sizer. Detach just removes the item from being positioned and sized by the sizer. If you want to have the old widget destroyed then you need to call widget.Destroy yourself.
On the other hand, there is no reason to have to work that hard. The wx.StaticBitmap class has a SetBitmap method so you can change which bitmap it is displaying without needing to destroy it and create another one.
ยทยทยท
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!