wxMenuItem::SetFont?

I created a wxTaskBarIcon for my app and a popup menu that is launched
when I right click the icon. Now I want to make the first item on the
menu to use a different font (basically I just want to give it a bold
style).

I tried this, but it's not working (the menu appears, but the font is
still the default system font, and no errors are raised):

        m = menu.FindItemByPosition(0)
        m.SetFont(f)

(f is a valid wxFont; tested in a StaticText and works).

What am I doing wrong?

[Python 2.3.3, wxPython 2.5.1.5, Win XP]

-- tacao

E. A. Tacao wrote:

I created a wxTaskBarIcon for my app and a popup menu that is launched
when I right click the icon. Now I want to make the first item on the
menu to use a different font (basically I just want to give it a bold
style).

I tried this, but it's not working (the menu appears, but the font is
still the default system font, and no errors are raised):

        m = menu.FindItemByPosition(0)
        m.SetFont(f)

(f is a valid wxFont; tested in a StaticText and works).

What am I doing wrong?

Apparently you can't change the font on an existing menu item, but if you create it, set it's attributes and *then* add it to the menu it will work.

         item = wx.MenuItem(menu, self.ID1,"Hello")
         item.SetBitmap(bmp)
         if wx.Platform == "__WXMSW__":
             item.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD))
         menu.AppendItem(item)

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

In Friday, May 28, 2004, 8:18:30 PM, Robin wrote:

Apparently you can't change the font on an existing menu item, but
if you create it, set it's attributes and *then* add it to the
menu it will work.

         item = wx.MenuItem(menu, self.ID1,"Hello")
         item.SetBitmap(bmp)
         if wx.Platform == "__WXMSW__":
             item.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD))
         menu.AppendItem(item)

Yes, this works. Thanks again, Robin.

-- tacao