Font change over riding alignment with wxStaticText?

Hi folks, Newbie to wxPython and the forum. I have an application
using wxStaticText and I am trying to righ align this and change the
font. The font change seems to override the right align. Simplified
code below.

thx bvd.

import wx

class Frame(wx.Frame):
    def __init__(self, parent, dList):

  wx.Frame.__init__(self, parent, -1, 'Alignment Test',
                size=(300, 200))

  panel = wx.Panel(self, -1)
  panel.SetBackgroundColour("White")

  # this works as expected
      label = wx.StaticText(panel, wx.NewId(), ' Name', (20, 20), (150,
-1), wx.ALIGN_RIGHT)

  # this does not - wx.Font seems to walk on the alignment
      label2 = wx.StaticText(panel, wx.NewId(), ' Name', (20, 60),
(150, -1), wx.ALIGN_RIGHT)
  label2.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL))

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

    def OnCloseWindow(self, event):
        self.Destroy()

class App(wx.App):

    def OnInit(self):
        self.frame = Frame(None, 'Test')
        self.frame.Show()
        self.SetTopWindow(self.frame)
        return True

if __name__ == '__main__':
    app = App(redirect=False)
    app.MainLoop()

Add the wx.ST_NO_AUTO_RESIZE style flag.

···

On 9/16/09 1:04 PM, bvd wrote:

Hi folks, Newbie to wxPython and the forum. I have an application
using wxStaticText and I am trying to righ align this and change the
font. The font change seems to override the right align. Simplified
code below.

--
Robin Dunn
Software Craftsman

Thanks for the quick reply Robin. It worked great once I removed the
underscore between 'AUTO' and 'RESIZE' :wink: Your book is on its way
from Amazon... bvd

···

On Sep 16, 3:58 pm, Robin Dunn <ro...@alldunn.com> wrote:

On 9/16/09 1:04 PM, bvd wrote:

> Hi folks, Newbie to wxPython and the forum. I have an application
> using wxStaticText and I am trying to righ align this and change the
> font. The font change seems to override the right align. Simplified
> code below.

Add the wx.ST_NO_AUTO_RESIZE style flag.

--
Robin Dunn
Software Craftsmanhttp://wxPython.org