Setting larger font for my wxPython app - across the board, but cannot increase windwos general font settings

41 views
Skip to first unread message

Antonio Goméz Soto

unread,
Apr 16, 2012, 5:03:29 PM4/16/12
to wxpytho...@googlegroups.com
Hi,

I am building some realtime report for a customer which is to be put up on a large LCD
screen. The report screen consists of a ListCtrl_virtual. I tried SetFont on the Ctrl,
but that didn't work.

The customer says he does not want to enlarge the font in windows, because it looks very bad.

I don't have access to such a large screen.

Is there a way I can enlarge all fonts in one go for my app?

Thanks,
Antonio

Robin Dunn

unread,
Apr 19, 2012, 5:05:02 PM4/19/12
to wxpytho...@googlegroups.com

Not really. Most widgets will 'inherit' the font set on their parent at
the time that the widget is created, but it is not perfect.


--
Robin Dunn
Software Craftsman
http://wxPython.org

Antonio Goméz Soto

unread,
Apr 19, 2012, 5:42:37 PM4/19/12
to wxpytho...@googlegroups.com, Robin Dunn
Op 19-04-12 23:05, Robin Dunn schreef:

Robin,

do you have some recommendation? I am using listctrl and lictrl_virtual almost exclusively,
so enlarging those might me get to 95% of what I want to accomplish

Thanks,
Antonio.

Patrick Maher

unread,
Apr 19, 2012, 6:58:26 PM4/19/12
to wxpytho...@googlegroups.com, Robin Dunn
Have you tried SetFont on the frame? E.g., in my frame initialization I put:

self.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL, wx.NORMAL))

Patrick

Antonio Goméz Soto

unread,
Apr 20, 2012, 2:16:18 AM4/20/12
to wxpytho...@googlegroups.com, Patrick Maher, Robin Dunn
Op 20-04-12 00:58, Patrick Maher schreef:

> Have you tried SetFont on the frame? E.g., in my frame initialization I put:
>
> self.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL, wx.NORMAL))
>
> Patrick
>

Patrick,

thanks, this is giving me encouraging results!

Antonio.

> --
> To unsubscribe, send email to wxPython-user...@googlegroups.com
> or visit http://groups.google.com/group/wxPython-users?hl=en

Paul Wiseman

unread,
Apr 20, 2012, 9:14:36 AM4/20/12
to wxpytho...@googlegroups.com
On 20 April 2012 07:16, Antonio Goméz Soto <antonio.g...@gmail.com> wrote:
Op 20-04-12 00:58, Patrick Maher schreef:
> Have you tried SetFont on the frame? E.g., in my frame initialization I put:
>
> self.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL, wx.NORMAL))
>
> Patrick
>

Patrick,

thanks, this is giving me encouraging results!


I have used functions before for settings drop targets over a whole frame and children before, maybe you could do something similar

def setFont(parent,*args,**kwargs):
    if hasattr(parent,"SetFont"):
        parent.SetFont(*args,**kwargs)
    if hasattr(parent,"Children"):
        for child in parent.Children:
            setFont(child,*args,**kwargs)

setFont(ref_to_frame,9,wx.SWISS,wx.NORMAL,wx.NORMAL)

Patrick Maher

unread,
Apr 21, 2012, 6:44:47 PM4/21/12
to wxpytho...@googlegroups.com
Paul,

The wx documentation says: "by default, all windows use their own default attributes. However if some of the parents attributes are explicitly (that is, using SetFont and not SetOwnFont) changed and if the corresponding attribute hadn't been explicitly set for this window itself, then this window takes the same value as used by the parent." So I'm wondering how your code can have a different effect to simply saying:

parent.SetFont(...)

Patrick 

Paul Wiseman

unread,
Apr 22, 2012, 5:34:27 AM4/22/12
to wxpytho...@googlegroups.com
Ah, I didn't realise this was the behaviour of SetFont, that's pretty useful! In that case, ignore my post :)
 
Patrick 

Robin Dunn

unread,
Apr 23, 2012, 12:38:29 PM4/23/12
to wxpytho...@googlegroups.com

The parent's font must be set before the child is created, as that is
when the attribute inheritance happens.

Paul Wiseman

unread,
Apr 23, 2012, 5:42:59 PM4/23/12
to wxpytho...@googlegroups.com
Would it possible to use that recursive function to set the cursor of a whole frame and all children after creation? ( .SetCursor with wx.StockCursor object)

Reply all
Reply to author
Forward
0 new messages