wx.MenuBar & SetFont (Linux not working)

How do you change the font of wx.MenuBar?

I am on Linux and tried this:

mb = wx.MenuBar(wx.ID_ANY)

if wx.Platform == "__WXGTK__":

            fnt = mb.GetFont()

            fnt.SetPointSize(fnt.GetPointSize()-2)

            mb.SetFont(fnt)

            mb.Refresh()

and

mb.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)

but it doesn't work.

wx.Menu doesn't have member function <SetFont>

wx.MenuItem is giving error when trying to set font as above:

(python:3015): Pango-CRITICAL **: pango_font_description_set_size:
assertion `size >= 0' failed

Prashant

#---- System Information ----#
Operating System: Linux 2.6.31-14-generic i686
Python Version: 2.6.4rc2 (r264rc2:75497, Oct 20 2009, 02:55:11)
[GCC 4.4.1]
wxPython Version: 2.8.10.1 (gtk2-unicode)
wxPython Info: (__WXGTK__, wxGTK, unicode, gtk2, wx-assertions-off,
SWIG-1.3.29)
Python Encoding: Default=UTF-8 File=UTF-8
wxPython Encoding: utf-8
System Architecture: 32bit i686
Byte order: little
Frozen: False
#---- End System Information ----#

Hi,

How do you change the font of wx.MenuBar?

I am on Linux and tried this:

mb = wx.MenuBar(wx.ID_ANY)

if wx.Platform == "__WXGTK__":

       fnt = mb\.GetFont\(\)

       fnt\.SetPointSize\(fnt\.GetPointSize\(\)\-2\)

       mb\.SetFont\(fnt\)

       mb\.Refresh\(\)

and

mb.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)

but it doesn't work.

wx.Menu doesn't have member function <SetFont>

wx.MenuItem is giving error when trying to set font as above:

(python:3015): Pango-CRITICAL **: pango_font_description_set_size:
assertion `size >= 0' failed

I don't think you can do it using the standard wx.MenuBar. But you
might be able to tweak FlatMenu in wx.lib.agw to get the behaviour you
want.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On 24 February 2010 06:57, King wrote: