问题描述
当显示来自 python/tkinter 的图像时,使用如下代码:
When showing images from python/tkinter, using code such as:
self.label = tk.Label(self.root, image=image)
self.label.pack()
图像在 MBP 视网膜上出现像素化,即每个轴上的像素加倍.
the image appears pixelated on a MBP retina, i.e. pixel-doubled in each axis.
有没有办法说服 tkinter 以原生"分辨率显示图像?如果没有,还有哪些其他解决方案可用于显示图像?当然,图像可以保存在别处查看,但我追求的是 GUI 选项.
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.
推荐答案
如果您使用 Tk 的 Cocoa 版本(例如 ActiveState 版本),您可能能够在程序的 plist 中添加一些内容,请参阅:https://developer.apple.com/library/mac/#documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html#//apple_ref/doc/uid/TP40012302-CH4-SW10
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
是
但不确定它是否有效.
如果您仍然使用旧的基于 Carbon 的版本,它将无法工作.
If you still use the older Carbon based version, it will not work.
这篇关于在缩放(例如视网膜)显示器上使用 Python/tkinter 显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!