问题
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