button labels with different font colors and styles

Hi all,

I want to put a text label on a button, but the label has different colors and styles:
some words are marked blue and are bold, other words are formatted normally.

I haven't found a way to do this. Is this possible? if yes, how can I achieve this?

Regards,
Joost

···

_________________________________________________________________
Use video conversation to talk face-to-face with Windows Live Messenger.
http://www.windowslive.com/messenger/connect_your_way.html?ocid=TXT_TAGLM_WL_Refresh_messenger_video_072008

I have a program that requires a legend,
I have created a frame that pops up and explains what each heading for
the rows and columns of a table mean. I want to use a static line to bisect
both the header from the data, and the row side from the column side. Unfortunately,
when I do this, the line gets resized to fit the sizer becoming unbearably
thick. Code follows:

import wx

class counter():

def init(self,start=None):

  if start == None:

     self.value

= -1

  else:

     self.value

= start-1

def next(self):

  self.value += 1

  return self.value

class KeyFrame(wx.Frame):

“”“A frame
for displaying legend information”""

def init(self,parent):

  wx.Frame.__init__(self,

parent, -1, “Key for Table”)

  panel = wx.Panel(self)

  rowpanel = wx.Panel(panel)

  rowsizer = wx.FlexGridSizer(cols=2)

  colpanel = wx.Panel(panel)

  colsizer = wx.FlexGridSizer(cols=2)

  sizer = wx.GridBagSizer(hgap=1,vgap=1)

 

  # Get the keys

from legend, if not defined, default to an empty dictionary

  rowKey = {}  
 # for simplicity assume there is no data in

the key yet.

  colKey = {}

  rowList=["1","2"]

  colList=["A","B","C"]



  # Create the key

heading

  sizer.Add(wx.StaticText(panel,

wx.ID_ANY, “Rows”), pos = (0,1), flag=wx.ALIGN_CENTER)

  sizer.Add(wx.StaticText(panel,

wx.ID_ANY, “Columns”), pos = (0,3), flag=wx.ALIGN_CENTER)

···
  #############################

These are the lines I want help with #############

  sizer.Add(wx.StaticLine(panel),

pos=(1,0), span=(1,5), flag=wx.ALL|wx.CENTER|wx.EXPAND) # a separation
line

  sizer.Add(wx.StaticLine(panel,style=wx.LI_VERTICAL),

pos=(0,2), span=(3,1), flag=wx.ALL|wx.CENTER|wx.EXPAND)

  ########################################################################

  sizer.AddGrowableRow(3)

  sizer.Add(wx.StaticText(panel,

wx.ID_ANY, “”), pos = (0,0)) # add a bit of space to the sides

  sizer.Add(wx.StaticText(panel,

wx.ID_ANY, “”), pos = (0,4))

  # Create the key

body

  row=counter(0)

display the row key

  for header in rowList:

     rowsizer.Add(wx.StaticText(rowpanel,

wx.ID_ANY, header+": "), 1, wx.ALIGN_RIGHT)

     rowsizer.Add(wx.StaticText(rowpanel,

wx.ID_ANY, str(rowKey.setdefault(header, “Undefined”))), 1, wx.ALIGN_LEFT)

  rowpanel.SetSizer(rowsizer)

  sizer.Add(rowpanel,pos=(2,1))

  col=counter(0)

display the col key

  for header in colList:

     colsizer.Add(wx.StaticText(colpanel,

wx.ID_ANY, header+": "), 1, wx.ALIGN_RIGHT)

     colsizer.Add(wx.StaticText(colpanel,

wx.ID_ANY, str(colKey.setdefault(header, “Undefined”))), 1, wx.ALIGN_LEFT)

  colpanel.SetSizer(colsizer)

  sizer.Add(colpanel,pos=(2,3))

 

  panel.SetSizer(sizer)

  sizer.Fit(self)

myApp = wx.App(False)

frame = KeyFrame(None).Show()

myApp.MainLoop()

I found a custom object that will force
the line to only grow in the specified direction. Adding this:

class NewStaticLine(wx.StaticLine):

“”"A class
that just defines the thin expandable separator line used in KeyFrame,

  the only difference

between this an a standard wx.StaticLine is that this one allows

  resizing in the

length direction, while stopping any in the width direction."""

def init(self, *args,
**kwargs):

  size = kwargs.get("size",

wx.Size(100, 100))

  style = kwargs.get("style",

wx.LI_HORIZONTAL)

  d = wx.StaticLine.GetDefaultSize()

  if style &

wx.LI_HORIZONTAL:

     kwargs["size"]

= (size[0], d)

  elif style &

wx.LI_VERTICAL:

     kwargs["size"]

= (d, size[1])

  wx.StaticLine.__init__(self,

*args, **kwargs)

  self.Bind(wx.EVT_SIZE,

self.OnSize)

def OnSize(self, evt):

  """Resizes

are only to be done in the “long” direction"""

  d = wx.StaticLine.GetDefaultSize()

  style = self.GetWindowStyleFlag()

  size = wx.StaticLine.GetSize(self)

  if style &

wx.LI_HORIZONTAL:

     size

= (size.width, d)

  elif style &

wx.LI_VERTICAL:

     size

= (d, size.height)

and changing the two lines in question
to use “NewStaticLine” instead of “wx.StaticLine” makes
nice thin, but off-center lines.

How does one add a static line that
grows only in one direction and can be centered?

-Brian

Brian Fett

1280 Disc Dr

SHK224

Shakopee, MN 55379

Phone: (952)402-2595

Brian.D.Fett@seagate.com