Tk Scaling on retina display (144dpi)


I’m on a Macbook Pro with a retina display. The ActiveState TK implementation does not seem to take the high dpi of the display into account. It doesn’t matter what I put the “tk scaling”. It makes no difference.

I’m under the impression that if I set “tk scaling” to 2.0, then set my root window height to 1080 it should take up 2160 dots on the screen. But that’s not what happens. No matter what the scaling is, 1080 remains 1080 at 72dpi which means it runs off the screen (which has an actual resolution of 2880x1800).

I have an image (144dpi) 250x1080 that I’m trying to display in a label and no matter what I try, it always runs off the screen. Am I missing something here? How do I get tk to take into account a 144dpi display?


to be more precise, if I leave tk scaling at the default and execute the following (with a tiff image that is 1080 pixels in height at 144dpi):

package require img::tiff
. configure -width 1.5i -height 7.5i
image create photo animg
animg read afile.tiff
label .imglabel -image animg -width 1.5i -height 7.5i -borderwidth 0 -padx 0 -pady 0
place .imglabel -x 0 -y 0

I get only about half of my image displayed in height. It doesn’t matter what the dpi is set in my tiff image. I’ve tried 72, 144, 220. The 7.5i specified in the window length ends up being about 4.25 inches on screen.

You’re probably better off asking this in one of Tcl/Tk forums, like Stackoverflow or going directly to Tcler’s wiki.

It sounds like your program is running at the default “Magnified Mode” for older Carbon-based applications (which is more common than you think with Tcl/Tk), and is not running with
NSHighResolutionCapable YES

The Tk scaling parameter does not affect everything that Tk can draw. (Example uses Python, but tkinter IS Tcl/Tk under the hood).

Thank you for this extra information! I’ve taken a look and the Wish app has NSHighResolutionCapable set to YES and low resolution mode is unchecked. I’ll keep looking around the resourced you’ve pointed me too and hopefully will be able to display an HD image at full resolution on screen. One thing I haven’t tried is using Canvas…maybe that would make a difference.