Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Tkinter Radiobutton:图像在OSX上像素化,但在Ubuntu中工作良好_Python_Macos_Tkinter_Radio Button_Tcltk - Fatal编程技术网

Python Tkinter Radiobutton:图像在OSX上像素化,但在Ubuntu中工作良好

Python Tkinter Radiobutton:图像在OSX上像素化,但在Ubuntu中工作良好,python,macos,tkinter,radio-button,tcltk,Python,Macos,Tkinter,Radio Button,Tcltk,我已经实现了一个单选按钮网格,每个单选按钮都有一个唯一的图像 我在下面包含了相关的代码行: photo[i] = ImageTk.PhotoImage(file=image_file) button[i] = Radiobutton(frame, variable=var, value=i+1, indicatoron=0, image=photo[i], selectcolor='#808080') button[i].pack(side=LEFT) OSX上的图像看起来非常像素化,如下所示

我已经实现了一个单选按钮网格,每个单选按钮都有一个唯一的图像

我在下面包含了相关的代码行:

photo[i] = ImageTk.PhotoImage(file=image_file)
button[i] = Radiobutton(frame, variable=var, value=i+1, indicatoron=0, image=photo[i], selectcolor='#808080')
button[i].pack(side=LEFT)
OSX上的图像看起来非常像素化,如下所示:

同样的代码适用于ubuntu(没有可见的像素)。下图为原始图像:


问题在于前面提到的tcl tk的系统版本

如果您使用的是macOS 10.6或更高版本,则苹果提供的Tcl/Tk 8.5 有可能导致应用程序崩溃的严重错误。如果你愿意 使用IDLE或Tkinter,不要使用苹果提供的蟒蛇。相反 从Python.org或 提供或链接更新版本的的第三方分销商 Tcl/Tk

这甚至让我有了模糊的单选按钮体验

如果您正在使用任何当前Python.org Python安装程序中的Python 对于macOS(3.9.0+、3.8.0+或3.7.2+),无需采取进一步措施 使用IDLE或tkinter。将使用内置版本的Tcl/Tk 8.6


我用IDLE运行我的代码,它工作得很好!虽然我仍然无法更改苹果公司提供的tcl tk有缺陷的系统。

无法复制,但它在osx 10.12.5上看起来非常完美。-可能会发布用于显示图像的整个代码(包括导入)。我有10.15.6,但我不认为这应该是错误源。你能提供你写的代码吗?这样我就可以在我的机器上检查了?谢谢。在我的系统上尝试了@ReblochonMasque代码。图像仍然是像素化的。