Here’s the problem. I created a custom object Tile(wx.Panel). It consists of a wx.GridSizer containing a 3x3 grid of square buttons labeled “1” through “9”. As the user clicks on a button, the button (and that digit) are removed from the display (button.Hide()). When there is only one button remaining the tile is considered “solved” and I hide the remaining button and
image = r'd:\script\python\sudoku\images\D' + digit + '.jpg'
bmp = wx.Image(image, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
self.bitmap = wx.StaticBitmap(self, -1, bmp, pos=(0, 0), size=(72,72))
display the solved digit in the Tile. So far so good. But when I want to reset the app so a new puzzle can be entered I want to clear the background image and unhide all of the buttons. I have tried two ways. One is to set the background image to a bitmap which is all white and the other is as follows
self.bitmap = wx.StaticBitmap(self, -1, pos=(0, 0), size=(72,72))
With the first method I end up with blank tiles. If I move the mouse cursor over the buttons they appear one by one. With the second method, any tile that had the background image set to a digit leaves that digit displayed (with the buttons appearing on a mouse_enter). Other tiles show the buttons as required.
I can either try to figure out why the buttons don’t automatically render on a button.Show() or try to find some way to remove the background image from the tile (method two obviously doesn’t do that). I’ve been running around in circles for two days trying to figure this out.
FYI - My tile is the most basic component of a Sudoku tool that I wrote (successfully) in vb.NET. I am porting it to Python/wxPython as a project to learn both.