[Tkinter-discuss] Differences on Mac and Windows

Michael Lange klappnase at web.de
Tue Feb 11 11:25:45 CET 2014


Hi,

On Tue, 11 Feb 2014 14:49:31 +0530
Bhaskar Chaudhary <bha100710 at gmail.com> wrote:

> Hi
> 
> The following piece of code displays correctly on Windows PC but it
> displays all messed up in OS X (10.9.1 and others) as shown in
> attachment below.
(...)
> 
> Any reasons why it shows the way it does on Mac.
> Thanks.
> 

I think "all messed up" is a little harsh for the mac screenshot ;)
Just a guess: the difference in the appearance of the border and the
font might be caused by a different dpi value in use by your windows and
OSX systems. You can check the respective values by adding the line

print 'DPI value: %f' % root.winfo_fpixels('1i')

to your example.
You can even force your application to use a custom dpi value, if you do

root.tk.call('tk', 'scaling', '-displayof', '.', dpi_value / 72.0)

_before_ creating any of root's child widgets.

As far as the font size is concerned, you can use pixel sized fonts to
minimize the risk of your font appearance getting spoiled by dpi
settings; to do so simply use a negative size value, as in
"Times -8 bold".

Regards

Michael


.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

Our way is peace.
		-- Septimus, the Son Worshiper, "Bread and Circuses",
		   stardate 4040.7.


More information about the Tkinter-discuss mailing list