How can I set the font of the choices text in a wx.ComboBox

How can I set the font of the choices text in a specific wx.ComboBox
to
wx.Font(11, wx.MODERN, wx.NORMAL, wx.NORMAL, 0, "Courier")
or similar?

···

#--------------
panel = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, (-1, -1), style = wx.SUNKEN_BORDER | wx.TAB_TRAVERSAL)
site_table = [ '*', 'L', 'A', 'E', 'D', 'T' ]
self.sel_site = wx.ComboBox(panel, wx.ID_CLOSE, size=wx.Size(105, 29), value=site_table[0], choices=site_table)
#--------------

Thanks and Grüessli
--
Kurt Müller, mu@problemlos.ch

Kurt Mueller wrote:

<div class="moz-text-flowed" style="font-family: -moz-fixed">How can I set the font of the choices text in a specific wx.ComboBox
to
wx.Font(11, wx.MODERN, wx.NORMAL, wx.NORMAL, 0, "Courier")
or similar?

#--------------
panel =x.Panel(self, wx.ID_ANY, wx.DefaultPosition, (-1, -1), style = wx.SUNKEN_BORDER | wx.TAB_TRAVERSAL)
site_table = '*', 'L', 'A', 'E', 'D', 'T' ]
self.sel_site =x.ComboBox(panel, wx.ID_CLOSE, size=wx.Size(105, 29), value=site_table[0], choices=site_table)
#--------------

Thanks and Grüessli

Try this:

self.sel_site.SetFont(wx.Font(11, wx.MODERN, wx.NORMAL, wx.NORMAL, 0, "Courier"))

···

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org

Mike Driscoll schrieb:

Try this:
self.sel_site.SetFont(wx.Font(11, wx.MODERN, wx.NORMAL, wx.NORMAL, 0, "Courier"))

Thanks.
I did that, but it did not change the font:

panel =wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, (-1, -1), style =wx.SUNKEN_BORDER | wx.TAB_TRAVERSAL)
site_table = '*', 'L', 'A', 'E', 'D', 'T' ]
self.sel_site =wx.ComboBox(panel, wx.ID_CLOSE, size=wx.Size(105, 29), value=site_table[0], choices=site_table)
self.sel_site.SetFont(wx.Font(7, wx.MODERN, wx.NORMAL, wx.NORMAL, 0, "Courier"))

In another place in the same prog I change the font for a ListCtrl
and that works:

self.lctr_test = wx.ListCtrl(panel, wx.ID_ANY, wx.DefaultPosition, (390, -1),
       style = wx.LC_REPORT | wx.LC_SINGLE_SEL | wx.LC_VRULES | wx.LC_HRULES | wx.FULL_REPAINT_ON_RESIZE) # ListCtrl
self.lctr_test.SetFont(wx.Font(7, wx.MODERN, wx.NORMAL, wx.NORMAL, 0, "Courier"))

Observation: (which I do not understand)
If I set the Font for the panel wherein the ComboBox and ListCtrl are
the Fonts on all controls change except that of the choices in the wx.ComboBox

System:
Linux susi96 2.6.22.17-0.1-default #1 SMP 2008/02/10 20:01:04 UTC i686 i686 i386 GNU/Linux
Python 2.5.1
wxPython 2.8.7.1

Grüessli

···

--
Kurt Müller, mu@problemlos.ch

Kurt Mueller wrote:

<div class="moz-text-flowed" style="font-family: -moz-fixed">Mike Driscoll schrieb:

That's weird! This worked on Windows XP. However, it doesn't appear to work on Ubuntu Hardy either. Here's a small runnable example:

<code>

[...]

</code>

With this code, the font does not change on my machine.
So: same erroneous behaviour, I think.

Yeah...I figured it wouldn't since it wouldn't work in Ubuntu but would on Windows XP.

I'm guessing the widget on Linux must not support font size changes.

Do you think there is a bug in the widget
on Linux (wxPython, wxGTK specific)?

Do you think it would be appropriate to
send a bug-report?

I'm not familiar enough with the wx source to know if it's that and I'm a newb at Linux too. Hopefully someone with more experience will pipe up.

> You might try the ComboCtrl instead since it's a custom widget
> and should allow more control over it.

I'll try that.

Grüessli

By the way, what does "Grüessli" mean?

Mike

One of the things I’ve been learning in the last few weeks, is that the widgets generally only support things that you can do natively. There have been several cosmetic things I’ve wanted to do but couldn’t because the platform didn’t allow it. While I’m working on OSX and not Linux, I’ve heard that on Linux what can and cannot be done is sometimes even theme specific.

When I run into these things I just try and come up with some other way of doing it, or if I can’t do that, I put it on the “to figure out later” list and go back to working on other things.

Likely not the answer you were looking for.

···

On Fri, Jun 27, 2008 at 1:54 AM, Kurt Mueller mu@problemlos.ch wrote:

Mike Driscoll schrieb:

That’s weird! This worked on Windows XP. However, it doesn’t appear to work on Ubuntu Hardy either. Here’s a small runnable example:

[…]

With this code, the font does not change on my machine.

So: same erroneous behaviour, I think.

I’m guessing the widget on Linux must not support font size changes.

Do you think there is a bug in the widget

on Linux (wxPython, wxGTK specific)?

Do you think it would be appropriate to

send a bug-report?


Stand Fast,
tjg.