简体   繁体   中英

Show images using Python/tkinter on scaled (e.g. retina) displays

When showing images from python/tkinter, using code such as:

self.label = tk.Label(self.root, image=image)
self.label.pack()

the image appears pixelated on a MBP retina, ie pixel-doubled in each axis.

Is there a way to persuade tkinter to show the image at 'native' resolution? If not, what other solutions are available to show the image? Of course the image can be saved a viewed elsewhere but I am after a GUI option.

If you use the Cocoa version of Tk (for example the ActiveState version), you might be able to add something to the plist of your program, see: https://developer.apple.com/library/mac/#documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html#//apple_ref/doc/uid/TP40012302-CH4-SW10

NSHighResolutionCapable YES

But not sure if it works.

If you still use the older Carbon based version, it will not work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM