I am a beginner in python but I would like to program a simple game using Python's "Button Panel" Demo code. I am not sure however on how to take that code out of the demo application and use it in my own application. Specifically, the following lines of code, I have no idea how to replace. I realize that the demo calls "parent" and I don't know what to say in place of "parent. (something)":

```
class SettingsPanel(wx.MiniFrame):

    def __init__(self, parent, id=wx.ID_ANY, title="Settings Panel", pos=wx.DefaultPosition,
             size=wx.DefaultSize,
             style=wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX | wx.FRAME_NO_TASKBAR
             | wx.FRAME_FLOAT_ON_PARENT | wx.CLIP_CHILDREN):

        wx.MiniFrame.__init__(self, parent, id, title, pos, size, style)

        self.targetTitleBar = parent.titleBar
        self.parent = parent
        self.panel = wx.Panel(self, -1)
    self.coloursizer_staticbox = wx.StaticBox(self.panel, -1, "Colour Options")
    self.bottomsizer_staticbox = wx.StaticBox(self.panel, -1, "Size Options")
    self.stylesizer_staticbox = wx.StaticBox(self.panel, -1, "ButtonPanel Styles")
    self.defaultstyle = wx.RadioButton(self.panel, -1, "Default Style", style=wx.RB_GROUP)
    self.gradientstyle = wx.RadioButton(self.panel, -1, "Gradient Style")
    self.verticalgradient = wx.RadioButton(self.panel, -1, "Vertical Gradient", style=wx.RB_GROUP)
    self.horizontalgradient = wx.RadioButton(self.panel, -1, "Horizontal Gradient")

    b = self.CreateColourBitmap(wx.BLACK)

    self.bakbrush = wx.BitmapButton(self.panel, ID_BackgroundColour, b, size=wx.Size(50,25))
    self.gradientfrom = wx.BitmapButton(self.panel, ID_GradientFrom, b, size=wx.Size(50,25))
    self.gradientto = wx.BitmapButton(self.panel, ID_GradientTo, b, size=wx.Size(50,25))
    self.bordercolour = wx.BitmapButton(self.panel, ID_BorderColour, b, size=wx.Size(50,25))
    self.captioncolour = wx.BitmapButton(self.panel, ID_CaptionColour, b, size=wx.Size(50,25))
    self.textbuttoncolour = wx.BitmapButton(self.panel, ID_ButtonTextColour, b, size=wx.Size(50,25))
    self.selectionbrush = wx.BitmapButton(self.panel, ID_SelectionBrush, b, size=wx.Size(50,25))
    self.selectionpen = wx.BitmapButton(self.panel, ID_SelectionPen, b, size=wx.Size(50,25))
    self.separatorcolour = wx.BitmapButton(self.panel, ID_SeparatorColour, b, size=wx.Size(50,25))

    self.separatorspin = wx.SpinCtrl(self.panel, -1, "7", min=3, max=20,
                                     style=wx.SP_ARROW_KEYS)
    self.marginspin = wx.SpinCtrl(self.panel, -1, "6", min=3, max=20,
                                  style=wx.SP_ARROW_KEYS)
    self.paddingspin = wx.SpinCtrl(self.panel, -1, "6", min=3, max=20,
                                   style=wx.SP_ARROW_KEYS)
    self.borderspin = wx.SpinCtrl(self.panel, -1, "3", min=3, max=7,
                                  style=wx.SP_ARROW_KEYS)

    self.__set_properties()
    self.__do_layout()

    self.Bind(wx.EVT_RADIOBUTTON, self.OnDefaultStyle, self.defaultstyle)
    self.Bind(wx.EVT_RADIOBUTTON, self.OnGradientStyle, self.gradientstyle)
    self.Bind(wx.EVT_RADIOBUTTON, self.OnVerticalGradient, self.verticalgradient)
    self.Bind(wx.EVT_RADIOBUTTON, self.OnHorizontalGradient, self.horizontalgradient)
    self.Bind(wx.EVT_BUTTON, self.OnSetColour, id=ID_BackgroundColour)
    self.Bind(wx.EVT_BUTTON, self.OnSetColour, id=ID_GradientFrom)
    self.Bind(wx.EVT_BUTTON, self.OnSetColour, id=ID_GradientTo)
    self.Bind(wx.EVT_BUTTON, self.OnSetColour, id=ID_BorderColour)
    self.Bind(wx.EVT_BUTTON, self.OnSetColour, id=ID_CaptionColour)
    self.Bind(wx.EVT_BUTTON, self.OnSetColour, id=ID_ButtonTextColour)
    self.Bind(wx.EVT_BUTTON, self.OnSetColour, id=ID_SelectionBrush)
    self.Bind(wx.EVT_BUTTON, self.OnSetColour, id=ID_SelectionPen)
    self.Bind(wx.EVT_BUTTON, self.OnSetColour, id=ID_SeparatorColour)

    self.Bind(wx.EVT_SPINCTRL, self.OnSeparator, self.separatorspin)
    self.Bind(wx.EVT_SPINCTRL, self.OnMargins, self.marginspin)
    self.Bind(wx.EVT_SPINCTRL, self.OnPadding, self.paddingspin)
    self.Bind(wx.EVT_SPINCTRL, self.OnBorder, self.borderspin)

    self.Bind(wx.EVT_CLOSE, self.OnClose)        

def __set_properties(self):

    self.defaultstyle.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
    self.defaultstyle.SetValue(1)
    self.gradientstyle.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
    self.verticalgradient.SetValue(1)

    if self.targetTitleBar.GetStyle() & bp.BP_DEFAULT_STYLE:
        self.verticalgradient.Enable(False)
        self.horizontalgradient.Enable(False)
        self.defaultstyle.SetValue(1)
    else:
        self.gradientstyle.SetValue(1)

    self.borderspin.SetValue(self.targetTitleBar.GetBPArt().GetMetric(bp.BP_BORDER_SIZE))
    self.separatorspin.SetValue(self.targetTitleBar.GetBPArt().GetMetric(bp.BP_SEPARATOR_SIZE))
    self.marginspin.SetValue(self.targetTitleBar.GetBPArt().GetMetric(bp.BP_MARGINS_SIZE).x)
    self.paddingspin.SetValue(self.targetTitleBar.GetBPArt().GetMetric(bp.BP_PADDING_SIZE).x)

    self.UpdateColours()        

def __do_layout(self):

    mainsizer = wx.BoxSizer(wx.VERTICAL)
    buttonsizer = wx.BoxSizer(wx.HORIZONTAL)
    bottomsizer = wx.StaticBoxSizer(self.bottomsizer_staticbox, wx.VERTICAL)
    sizer_13 = wx.BoxSizer(wx.HORIZONTAL)
    sizer_12 = wx.BoxSizer(wx.HORIZONTAL)
    sizer_11 = wx.BoxSizer(wx.HORIZONTAL)
    sizer_10 = wx.BoxSizer(wx.HORIZONTAL)
    coloursizer = wx.StaticBoxSizer(self.coloursizer_staticbox, wx.HORIZONTAL)
    rightsizer = wx.BoxSizer(wx.VERTICAL)
    sizer_9 = wx.BoxSizer(wx.HORIZONTAL)
    sizer_8 = wx.BoxSizer(wx.HORIZONTAL)
    sizer_7 = wx.BoxSizer(wx.HORIZONTAL)
    sizer_6 = wx.BoxSizer(wx.HORIZONTAL)
    leftsizer = wx.BoxSizer(wx.VERTICAL)
    sizer_5 = wx.BoxSizer(wx.HORIZONTAL)
    sizer_4 = wx.BoxSizer(wx.HORIZONTAL)
    sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
    sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
    sizer_1 = wx.BoxSizer(wx.HORIZONTAL)
    stylesizer = wx.StaticBoxSizer(self.stylesizer_staticbox, wx.VERTICAL)
    tophsizer = wx.BoxSizer(wx.HORIZONTAL)
    tophsizer2 = wx.BoxSizer(wx.VERTICAL)

    stylesizer.Add(self.defaultstyle, 0, wx.ALL|wx.EXPAND|wx.ADJUST_MINSIZE, 5)

    tophsizer.Add(self.gradientstyle, 0, wx.LEFT|wx.RIGHT|wx.EXPAND|
                  wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)

    tophsizer2.Add(self.verticalgradient, 0, wx.BOTTOM|wx.ADJUST_MINSIZE, 3)
    tophsizer2.Add(self.horizontalgradient, 0, wx.ADJUST_MINSIZE, 0)

    tophsizer.Add(tophsizer2, 1, wx.LEFT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 10)

    stylesizer.Add(tophsizer, 1, wx.EXPAND, 0)

    mainsizer.Add(stylesizer, 0, wx.ALL|wx.EXPAND, 5)

    label_1 = wx.StaticText(self.panel, -1, "Background Brush Colour:")
    sizer_1.Add(label_1, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)
    sizer_1.Add((0, 0), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
    sizer_1.Add(self.bakbrush, 0, wx.ADJUST_MINSIZE, 0)

    leftsizer.Add(sizer_1, 1, wx.EXPAND, 0)

    label_2 = wx.StaticText(self.panel, -1, "Gradient Colour From:")
    sizer_2.Add(label_2, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)
    sizer_2.Add((0, 0), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
    sizer_2.Add(self.gradientfrom, 0, wx.ADJUST_MINSIZE, 0)

    leftsizer.Add(sizer_2, 1, wx.EXPAND, 0)

    label_3 = wx.StaticText(self.panel, -1, "Gradient Colour To:")
    sizer_3.Add(label_3, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)
    sizer_3.Add((0, 0), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
    sizer_3.Add(self.gradientto, 0, wx.ADJUST_MINSIZE, 0)

    leftsizer.Add(sizer_3, 1, wx.EXPAND, 0)

    label_4 = wx.StaticText(self.panel, -1, "Border Colour:")
    sizer_4.Add(label_4, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)
    sizer_4.Add((0, 0), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
    sizer_4.Add(self.bordercolour, 0, wx.ADJUST_MINSIZE, 0)

    leftsizer.Add(sizer_4, 1, wx.EXPAND, 0)

    label_5 = wx.StaticText(self.panel, -1, "Main Caption Colour:")
    sizer_5.Add(label_5, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)
    sizer_5.Add((0, 0), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
    sizer_5.Add(self.captioncolour, 0, wx.ADJUST_MINSIZE, 0)

    leftsizer.Add(sizer_5, 1, wx.EXPAND, 0)

    coloursizer.Add(leftsizer, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
    coloursizer.Add((20, 20), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)

    label_6 = wx.StaticText(self.panel, -1, "Text Button Colour:")
    sizer_6.Add(label_6, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)
    sizer_6.Add((0, 0), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
    sizer_6.Add(self.textbuttoncolour, 0, wx.ADJUST_MINSIZE, 0)

    rightsizer.Add(sizer_6, 1, wx.EXPAND, 0)

    label_7 = wx.StaticText(self.panel, -1, "Selection Brush Colour:")
    sizer_7.Add(label_7, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)
    sizer_7.Add((0, 0), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
    sizer_7.Add(self.selectionbrush, 0, wx.ADJUST_MINSIZE, 0)

    rightsizer.Add(sizer_7, 1, wx.EXPAND, 0)

    label_8 = wx.StaticText(self.panel, -1, "Selection Pen Colour:")
    sizer_8.Add(label_8, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)
    sizer_8.Add((0, 0), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
    sizer_8.Add(self.selectionpen, 0, wx.ADJUST_MINSIZE, 0)

    rightsizer.Add(sizer_8, 1, wx.EXPAND, 0)

    label_9 = wx.StaticText(self.panel, -1, "Separator Colour:")
    sizer_9.Add(label_9, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)
    sizer_9.Add((0, 0), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
    sizer_9.Add(self.separatorcolour, 0, wx.ADJUST_MINSIZE, 0)

    rightsizer.Add(sizer_9, 1, wx.EXPAND, 0)

    coloursizer.Add(rightsizer, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)

    mainsizer.Add(coloursizer, 0, wx.ALL|wx.EXPAND, 5)

    label_10 = wx.StaticText(self.panel, -1, "Separator Size:")
    sizer_10.Add(label_10, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)
    sizer_10.Add((0, 0), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
    sizer_10.Add(self.separatorspin, 0, wx.ALL|wx.ADJUST_MINSIZE, 5)

    bottomsizer.Add(sizer_10, 1, wx.EXPAND, 0)

    label_11 = wx.StaticText(self.panel, -1, "Margins Size:")
    sizer_11.Add(label_11, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)
    sizer_11.Add((0, 0), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
    sizer_11.Add(self.marginspin, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.ADJUST_MINSIZE, 5)

    bottomsizer.Add(sizer_11, 1, wx.EXPAND, 0)

    label_12 = wx.StaticText(self.panel, -1, "Padding Size:")
    sizer_12.Add(label_12, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)
    sizer_12.Add((0, 0), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
    sizer_12.Add(self.paddingspin, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.ADJUST_MINSIZE, 5)

    bottomsizer.Add(sizer_12, 1, wx.EXPAND, 0)

    label_13 = wx.StaticText(self.panel, -1, "Border Size:")
    sizer_13.Add(label_13, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)
    sizer_13.Add((0, 0), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
    sizer_13.Add(self.borderspin, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.ADJUST_MINSIZE, 5)

    bottomsizer.Add(sizer_13, 1, wx.EXPAND, 0)

    mainsizer.Add(bottomsizer, 0, wx.ALL|wx.EXPAND, 5)

    self.panel.SetSizer(mainsizer)
    sizer = wx.BoxSizer()
    sizer.Add(self.panel, 1, wx.EXPAND)
    self.SetSizer(sizer)
    self.Fit()

def CreateColourBitmap(self, c):

    image = wx.EmptyImage(25, 14)

    for x in xrange(25):
        for y in xrange(14):
            pixcol = c
            if x == 0 or x == 24 or y == 0 or y == 13:
                pixcol = wx.BLACK

            image.SetRGB(x, y, pixcol.Red(), pixcol.Green(), pixcol.Blue())

    return image.ConvertToBitmap()

def UpdateColours(self):

    bk = self.targetTitleBar.GetBPArt().GetColour(bp.BP_BACKGROUND_COLOUR)
    self.bakbrush.SetBitmapLabel(self.CreateColourBitmap(bk))

    capfrom = self.targetTitleBar.GetBPArt().GetColour(bp.BP_GRADIENT_COLOUR_FROM)
    self.gradientfrom.SetBitmapLabel(self.CreateColourBitmap(capfrom))

    capto = self.targetTitleBar.GetBPArt().GetColour(bp.BP_GRADIENT_COLOUR_TO)
    self.gradientto.SetBitmapLabel(self.CreateColourBitmap(capto))

    captxt = self.targetTitleBar.GetBPArt().GetColour(bp.BP_TEXT_COLOUR)
    self.captioncolour.SetBitmapLabel(self.CreateColourBitmap(captxt))

    bor = self.targetTitleBar.GetBPArt().GetColour(bp.BP_BORDER_COLOUR)
    self.bordercolour.SetBitmapLabel(self.CreateColourBitmap(bor))

    btntext = self.targetTitleBar.GetBPArt().GetColour(bp.BP_BUTTONTEXT_COLOUR)
    self.textbuttoncolour.SetBitmapLabel(self.CreateColourBitmap(btntext))

    selb = self.targetTitleBar.GetBPArt().GetColour(bp.BP_SELECTION_BRUSH_COLOUR)
    self.selectionbrush.SetBitmapLabel(self.CreateColourBitmap(selb))

    selp = self.targetTitleBar.GetBPArt().GetColour(bp.BP_SELECTION_PEN_COLOUR)
    self.selectionpen.SetBitmapLabel(self.CreateColourBitmap(selp))

    sepc = self.targetTitleBar.GetBPArt().GetColour(bp.BP_SEPARATOR_COLOUR)
    self.separatorcolour.SetBitmapLabel(self.CreateColourBitmap(sepc))

def OnDefaultStyle(self, event):

    self.verticalgradient.Enable(False)
    self.horizontalgradient.Enable(False)
    self.targetTitleBar.SetStyle(bp.BP_DEFAULT_STYLE)

    self.targetTitleBar.Refresh()

    event.Skip()

def OnGradientStyle(self, event): 

    self.verticalgradient.Enable(True)
    self.horizontalgradient.Enable(True)
    self.targetTitleBar.SetStyle(bp.BP_USE_GRADIENT)
    self.targetTitleBar.Refresh()

    event.Skip()

def OnVerticalGradient(self, event):

    self.targetTitleBar.GetBPArt().SetGradientType(bp.BP_GRADIENT_VERTICAL)
    self.targetTitleBar.SetStyle(bp.BP_USE_GRADIENT)
    self.targetTitleBar.Refresh()

    event.Skip()

def OnHorizontalGradient(self, event):

    self.targetTitleBar.GetBPArt().SetGradientType(bp.BP_GRADIENT_HORIZONTAL)
    self.targetTitleBar.SetStyle(bp.BP_USE_GRADIENT)
    self.targetTitleBar.Refresh()

    event.Skip()

def OnSetColour(self, event):

    dlg = wx.ColourDialog(self.parent)

    dlg.SetTitle("Colour Picker")

    if dlg.ShowModal() != wx.ID_OK:
        return

    var = 0
    if event.GetId() == ID_BackgroundColour:
        var = bp.BP_BACKGROUND_COLOUR
    elif event.GetId() == ID_GradientFrom:
        var = bp.BP_GRADIENT_COLOUR_FROM
    elif event.GetId() == ID_GradientTo:
        var = bp.BP_GRADIENT_COLOUR_TO
    elif event.GetId() == ID_BorderColour:
        var = bp.BP_BORDER_COLOUR
    elif event.GetId() == ID_CaptionColour:
        var = bp.BP_TEXT_COLOUR
    elif event.GetId() == ID_ButtonTextColour:
        var = bp.BP_BUTTONTEXT_COLOUR
    elif event.GetId() == ID_SelectionBrush:
        var = bp.BP_SELECTION_BRUSH_COLOUR
    elif event.GetId() == ID_SelectionPen:
        var = bp.BP_SELECTION_PEN_COLOUR
    elif event.GetId() == ID_SeparatorColour:
        var = bp.BP_SEPARATOR_COLOUR
    else:
        return        

    self.targetTitleBar.GetBPArt().SetColour(var, dlg.GetColourData().GetColour())
    self.targetTitleBar.Refresh()
    self.UpdateColours()

    self.parent.useredited = True

def OnSeparator(self, event):

    self.targetTitleBar.GetBPArt().SetMetric(bp.BP_SEPARATOR_SIZE,
                                             event.GetInt())

    self.targetTitleBar.DoLayout()
    self.parent.mainPanel.Layout()
    self.parent.useredited = True

    event.Skip()

def OnMargins(self, event):

    self.targetTitleBar.GetBPArt().SetMetric(bp.BP_MARGINS_SIZE,
                                             wx.Size(event.GetInt(), event.GetInt()))

    self.targetTitleBar.DoLayout()
    self.parent.mainPanel.Layout()

    self.parent.useredited = True

    event.Skip()

def OnPadding(self, event):

    self.targetTitleBar.GetBPArt().SetMetric(bp.BP_PADDING_SIZE,
                                             wx.Size(event.GetInt(), event.GetInt()))

    self.targetTitleBar.DoLayout()
    self.parent.mainPanel.Layout()
    self.parent.useredited = True

    event.Skip()

def OnBorder(self, event):

    self.targetTitleBar.GetBPArt().SetMetric(bp.BP_BORDER_SIZE,
                                             event.GetInt())

    self.targetTitleBar.DoLayout()
    self.parent.mainPanel.Layout()

    self.parent.useredited = True

    event.Skip()

def OnClose(self, event):

    self.parent.hassettingpanel = False
    self.Destroy()enter code here

```

For example, what would I put in place of "parent.titleBar"? And would I need to change anything else in the code to make it run independently?