Hi all,
I’m back in the saddle on a back-burner project, and item 1 is refactoring a 450-line object that does too much.
I want a window - Panel, probably - that is structured (well, can’t get preformatted to format correctly, so image a smaller vertical widget panel on the right and a larger image panel on the left)
---------------------------------------------------------
| Bitmap 800x600 | Buttons |
| that can be drawn upon | and |
| | Dropdowns |
---------------------------------------------------------
This was all one panel in the original code. I think it should be two separate Panels, both inside a Panel? And, I am unsure as to whether the drawing methods for the bitmap should belong to the Panel that owns the bitmap OR to the bitmap itself.
In other words, is the best approach
Option 1:
class MyStaticBitmap(wx.StaticBitmap):
# drawing methods go here
class MyImagePanel(wx.Panel):
def __init__(self):
image = MyStaticBitmap(self, image_from_file)
#respond to mouse events by calling MyStaticBitmap methods
OR
Option 2:
class MyImagePanel(wx.Panel):
def __init__(self):
image = wx.StaticBitmap(self,image_from_file)
# drawing methods go here
# mouse events call drawing methods
All advice appreciated.