#!/usr/bin/python ######################################### # For gui-demo only Richard Terry February 2005 # This panel consists constructs a simple heading to be used at the top # of a panel, in the form of capitalised word on user defined foreground # and background colours ######################################### import wx richards_blue = wx.Colour(0,0,131) richards_aqua = wx.Colour(0,194,197) class Label(wx.Panel): # def __init__(self, parent, id, title, bg_red, bg_blue, bg_green,fg_red, fg_blue, fg_green): # this to be used once the rgb thingy is fixed def __init__(self, parent, id, title,fgcolour): wx.Panel.__init__(self, parent, id, wx.DefaultPosition, wx.DefaultSize, wx.NO_BORDER ) self.SetBackgroundColour(wx.Colour(255,255,255)) #197,194,255)) #set main panel background color self.caption = wx.StaticText(self,-1, title,style = wx.ALIGN_LEFT) # static text for the caption self.caption.SetForegroundColour(fgcolour) self.caption.SetFont(wx.Font(10,wx.SWISS,wx.NORMAL,wx.BOLD,False,'')) captionsizer = wx.BoxSizer(wx.VERTICAL) captionsizer.Add(self.caption,5,wx.EXPAND) self.SetSizer(captionsizer) #set the sizer captionsizer.Fit(self) #set to minimum size as calculated by sizer self.SetAutoLayout(True) #tell frame to use the sizer self.Show(True) #show the panel def SetCaptionBackgroundColor(self, bg_red, bg_blue, bg_green): self.SetBackgroundColour(wx.Colour(bg_red,bg_blue,bg_green)) return def SetCaptionForegroundColor(self, fg_red, fg_blue, fg_green): self.caption.SetForegroundColour(wx.Colour(fg_red,fg_blue,fg_green)) def SetCaption(self,label): self.caption.SetLabel(label) return if __name__ == "__main__": app = wx.PyWidgetTester(size = (200, 20)) app.SetWidget(Label, -1,"Target Disease",richards_blue) app.MainLoop()