Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

fonts in tcl/tk dialog boxes

87 views
Skip to first unread message

magicme

unread,
Apr 8, 2007, 8:32:56 AM4/8/07
to
the fonts in the dialog boxes (tk_getOpenFile, etc ) in my tcl/tk
applications look terrible, and i cannot find a way to redefine them.
i can define fonts for textboxes, etc that look good, but can't fix
the standard diaolog box fonts.

also i notice that these look poor in DEBIAN and horrid in UBUNTU
(same program).
i checked the [fonts:///] directory and looks like every font in
creation is there.

by 'terrible' i maean very small and very jagged.
i tried changing my GNOME desktop preferences but that did not work.
i also search this site and (if i understand the postings) this does
not look easily solvable.

any guidance would be much appreciated.

regards

magicme

Michael Schlenker

unread,
Apr 8, 2007, 6:14:23 PM4/8/07
to
magicme schrieb:

There are some things that could go wrong in this case:
1. Your X server lies about the true screen resolution, which affects
'tk scaling'
Read about it here: http://wiki.tcl.tk/8484

2. You use a Tcl/Tk version below 8.5alpha, which does not support
antialiased fonts (Tk 8.5 does if compiled with --enable-xft)

3. The app finds the wrong font.

The tk_getOpenFile etc. dialogs for unix are a bit dated looking, you
can find their implementation in the tk library dir. There are some
replacement dialogs available on the Tcl'ers wiki, which look nicer/more
modern on Unix.

The GNOME desktop preferences probably do nothing for Tk, as GNOME
invented (as always) its own configuration scheme instead of the
standard X11 option database which is used by Tk. You could try to add
some options to it for your font settings.

See:
http://wiki.tcl.tk/option

Michael


magicme

unread,
Apr 8, 2007, 6:53:48 PM4/8/07
to


Michael,

Thanks for your time and input.

i will read into those issues.

magicme


Synic

unread,
Apr 9, 2007, 2:42:59 AM4/9/07
to
magicme <dav...@tikmark.com> wrote:
> the fonts in the dialog boxes (tk_getOpenFile, etc ) in my tcl/tk
> applications look terrible, and i cannot find a way to redefine them.
> i can define fonts for textboxes, etc that look good, but can't fix
> the standard diaolog box fonts.

Here's a little trick I use. I forget where I originally saw it.

First, declare a font called font_p:

font configure font_p -family "Helvetica" -size 12 -underline 0

Then:

foreach class { Button Checkbutton Entry Label Listbox Menu Menubutton
Message Radiobutton Scale MessageBox Text Dialog.msg } {
option add *$class.font font_p widgetDefault }

It won't give you anti-aliasing, of course. But you'll get to use your
favourite Truetype font instead of whatever badly scaled X11 bitmap
fonts you were picking up as defaults before.

Of course, if your script is being used on multiple platforms, you'll
want to run a switch on the OS name to choose fonts that will be there
on the system, look good and preferably fit in with the rest of the OS
dialogs.

Hope that helps.

magicme

unread,
Apr 9, 2007, 7:50:26 AM4/9/07
to
On Apr 9, 2:42 am, Synic <flavp+hfr...@nhgbaf.arg.nh> wrote:

PERFECT!

thank you Synic.

magicme


0 new messages