[Tkinter-discuss] Screen Resolution for tkinter

jepler at unpythonic.net jepler at unpythonic.net
Tue Dec 14 05:51:24 CET 2004


winfo_reqwidth and winfo_reqheight methods return the space *requested* by
a widget.  For widgets that contain widgets, a call to update_idletasks
is required for all widgets to decide their requested size.

wm_minsize, wm_maxsize, and wm_geometry control the range of sizes the user
may select, and query/set the actual size of the window.  These sizes all
exclude the height of the menubar (if any) and window decorations.

Many screen distances can be given in mm, which is combined with the
OS-reported DPI values.  Likewise, fonts may be requested in points which
are related to the OS-reported screen resolution, not to pixel sizes.

Many widgets have width= and height= configuration parameters.
When widgets contain text, these are in units of average character widths
and vertical line spaces.  When they contain images, the units are pixels.

The best way to consistently set font sizes is to do nothing in your
application.  Tk is intended to find the system defaults and follow them.
On Windows, these settings come from the "display properties" dialog, and
on Unix these settings come from the X resources database.  The second best
is to use the "option" command (not sure of the Tkinter method name)
to add entries to the option database before creating any widgets.  There
must be documents somewhere that describe this, I would get the details
wrong if I tried to do it here.  The worst way is to specify font= on each
individual widget.

This is all documented in the Tk manpages, and even if it's painful to wade
through the Tcl syntax it's a valuable source of information.  For a few
widgets the information in the Tk manpages have been transcribed to the wiki.
Links to online versions of the Tk manpages are also on the wiki.  Be sure
to take a look.

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.python.org/pipermail/tkinter-discuss/attachments/20041213/0218f473/attachment.pgp


More information about the Tkinter-discuss mailing list