Problem on changing PointSize in Font of wx.SpinCtrl

Hi folks,

I'm trying to change the wx.Font point size in wx.SpinCtrl, but it is
not working under MacOS X (Leopard 10.5.5). The font size simply
doesn't change - no matter 2, 20 or 200 is set in its font's
pointSize.

It worked fine under Fedora 10 and Windows XP. Any ideas?

The code is presented bellow.

Thanks in advance!

Regards,

Tatiana

PS: Currently using:
- Python 2.5
- wxPython 2.8.9.1

···

-------------------

import wx
class MainWindow(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, size=(400,400))
        self.control = wx.SpinCtrl(parent=self, id=-1, min=0, max=5000)
        self.control.SetValue(2034)

        # First try on changing font size
        font = self.control.GetFont()
        font.SetPointSize(200) # tried both 2, 20 and 200 but the font
is the same size

        # Second try
        #font = wx.Font(pointSize = 200,
        # family = wx.FONTFAMILY_DEFAULT,
        # style = wx.NORMAL,
        # weight = wx.FONTWEIGHT_LIGHT)

        # Third try
        #font = wx.FFont(pointSize = 200, family = wx.FONTFAMILY_DEFAULT)

        self.control.SetFont(font)

        print "PointSize", self.control.GetFont().GetPointSize()
        self.Show(True)

app = wx.PySimpleApp()
frame=MainWindow(None, wx.ID_ANY, 'Playing with wx.SpinCtrl font size')
app.MainLoop()

Hello,

Hi folks,

I'm trying to change the wx.Font point size in wx.SpinCtrl, but it is
not working under MacOS X (Leopard 10.5.5). The font size simply
doesn't change - no matter 2, 20 or 200 is set in its font's
pointSize.

It worked fine under Fedora 10 and Windows XP. Any ideas?

The SpinCtrl is a composite control on OSX. So you may need to do something like the following to change the font size of the text control portion of the control.

for child in self.control.GetChildren():
            if isinstance(child, wx.TextCtrl):
                font = self.control.GetFont()
                font.SetPointSize(20)
                child.SetFont(font)
                break

Cody

···

On Nov 25, 2008, at 7:02 AM, Tatiana Al-Chueyr Pereira Martins wrote:

Thanks, Cody! It has worked perfectly.

Best regards.

Tatiana

···

--------
Date: Tue, 25 Nov 2008 07:22:07 -0600
From: Cody Precord <codyprecord@gmail.com>
Subject: Re: [wxpython-users] Problem on changing PointSize in Font of
       wx.SpinCtrl
To: wxpython-users@lists.wxwidgets.org
Message-ID: <507DAA19-7C44-4BE2-8E2F-8B26E96B4AD2@gmail.com>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes

Hello,

On Nov 25, 2008, at 7:02 AM, Tatiana Al-Chueyr Pereira Martins wrote:

Hi folks,

I'm trying to change the wx.Font point size in wx.SpinCtrl, but it is
not working under MacOS X (Leopard 10.5.5). The font size simply
doesn't change - no matter 2, 20 or 200 is set in its font's
pointSize.

It worked fine under Fedora 10 and Windows XP. Any ideas?

The SpinCtrl is a composite control on OSX. So you may need to do
something like the following to change the font size of the text
control portion of the control.

for child in self.control.GetChildren():
           if isinstance(child, wx.TextCtrl):
               font = self.control.GetFont()
               font.SetPointSize(20)
               child.SetFont(font)
               break

Cody