From: Zbigniew Diaczyszyn on 8 Apr 2010 10:24 I want to give the user of my project the possibility to change the font size of the application so that according to the platform and the graphic equipment he is using he can choose the font and the size he likes. Is it possible to change the font of the entire application at one blow, for example in changing the main window options? I tried the following lines which worked fine: font configure TkDefaultFont -size $mysize font configure TkTextFont -size $mysize font configure TkMenuFont -size $mysize But the manual tells me: "It is not advised to change these fonts, as they may be modified by Tk itself in response to system changes. Instead, make a copy of the font and modify that." Ok, I made a copy and assigned it to the main window: eval font create myfont [font actual TkDefaultFont] ::ttk::style configure . -font myfont font configure myfont -size $mysize The treeview entries, the buttons and the labels are configured but not the main menubar and the entry fields: They belong to TkTextFont, respectively TkMenuFont I could not find a way to replace the TkMenuFont by the new ttk::style method with myfont. The old way works: menu .mbar -font myfont But the ttk::entry widget stays unconfigured: ttk::style configure TEntry -font myfont will not show the desired effect. But it is a new themed widget, isn't it? The brute force way - it was my first try :-) will finally configure the entry and combobox fields, too: option add *font myfont Adding just this line will leave the title in the notebook tabs unchanged ... Is there no top down and simple way to change the font of the entire application?
From: Joe English on 8 Apr 2010 11:03 Zbigniew Diaczyszyn wrote: > > I want to give the user of my project the possibility to change the font > size of the application so that according to the platform and the > graphic equipment he is using he can choose the font and the size he likes. > > Is it possible to change the font of the entire application at one blow, > for example in changing the main window options? > > I tried the following lines which worked fine: > > font configure TkDefaultFont -size $mysize > font configure TkTextFont -size $mysize > font configure TkMenuFont -size $mysize > > But the manual tells me: > > "It is not advised to change these fonts, as they may be modified by Tk > itself in response to system changes. Instead, make a copy of the font > and modify that." I think the manpage gives bad advice in this instance. For what you're trying to do -- let users change fonts application-wide -- configuring TkDefaultFont et. al is *exactly* the right thing. That's what they were designed for. And if Tk modifies them in response to system changes as the manpage warns that it might, well, that will be because the user asked it to. Which is what you want. So my advice: modify TkDefaultFont, TkTextFont, etc., just like you were doing. --Joe English
From: MSEdit on 9 Apr 2010 03:42 One small word of warning though, these fonts are used for different things, menus, tooltips and are by defnintion not all the same size for esthetic reasons. You should not just change all the sizes to be the same. Try to find a way to keep the sizes relative. Also remember that they are not all the same font as well so a 12 point in one font will not be pretty in the other (or even exist). Especially on older linux systems which only have a fixed set of bitmap fonts not outlined scalable fonts. I spent alot of time trying to keep things legible when the user changes fonts. (this was mainly to do with keeping normal/italic/bold fonts together. Did you know that some fonts do not have bold/italic equivalents on Linux. Martyn
From: Donal K. Fellows on 9 Apr 2010 05:38 On 9 Apr, 08:42, MSEdit <mse...(a)gmail.com> wrote: > Did you know that some fonts do not have bold/italic equivalents on > Linux. Yes. Incomplete font-sets are a PITA. Donal.
From: WJG on 9 Apr 2010 14:18 If your working on Linux and want that genuine native look, why not try Gnocl? Gtk+ allows the application wide reconfiguration of default widget settings using a 'resource' file. Check the manual page. http://sites.google.com/site/gnocltclgtk/gnocl-user-documentation/concepts/resource-files WJG
|
Next
|
Last
Pages: 1 2 3 Prev: ttk notebook generate event Next: Problem with ; character with eval command |