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

你。 提交于 2019-12-11 10:34:50

问题


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, i.e. 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.


回答1:


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.



来源:https://stackoverflow.com/questions/12318172/show-images-using-python-tkinter-on-scaled-e-g-retina-displays

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!