Show images using Python/tkinter on scaled (e.g. r

2019-07-30 10:37发布

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条回答
对你真心纯属浪费
2楼-- · 2019-07-30 11:33

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.

查看更多
登录 后发表回答