Skip to content

Instantly share code, notes, and snippets.

@driscollis
Created May 21, 2015 20:39
Show Gist options
  • Save driscollis/7f2e10f3c0fd32700797 to your computer and use it in GitHub Desktop.
Save driscollis/7f2e10f3c0fd32700797 to your computer and use it in GitHub Desktop.
import wx
########################################################################
class MyPanel(wx.Panel):
""""""
#----------------------------------------------------------------------
def __init__(self, parent, bg=None):
"""Constructor"""
wx.Panel.__init__(self, parent)
if bg:
self.SetBackgroundColour(bg)
########################################################################
class MyFrame(wx.Frame):
""""""
#----------------------------------------------------------------------
def __init__(self):
"""Constructor"""
wx.Frame.__init__(self, None, title="Test")
panel = MyPanel(self)
panel_sizer = wx.BoxSizer(wx.VERTICAL)
panel_one = MyPanel(panel, 'red')
panel_sizer.Add(panel_one, 1, wx.EXPAND)
panel_two = MyPanel(panel, 'green')
panel_sizer.Add(panel_two, 2, wx.EXPAND)
panel.SetSizer(panel_sizer)
self.Show()
if __name__ == '__main__':
app = wx.App(False)
frame = MyFrame()
app.MainLoop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment