我正在测试使用Tkinter模块创建GUI.我试图使用PIL将图像添加到GUI.我的代码看起来像这样:
import Tkinter as tk
from PIL import Image, ImageTk
root = tk.Tk()
root.title('background image')
imfile = "foo.png"
im = Image.open(imfile)
im1 = ImageTk.PhotoImage(im)
Run Code Online (Sandbox Code Playgroud)
当我运行此代码时,我想出了一些导致段错误的错误.
objc[5431]: Class TKApplication is implemented in both/Users/sykeoh/anaconda/lib/libtk8.5.dylib and /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined.
objc[5431]: Class TKMenu is implemented in both /Users/sykeoh/anaconda/lib/libtk8.5.dylib and /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined.
objc[5431]: Class TKContentView is implemented in both /Users/sykeoh/anaconda/lib/libtk8.5.dylib and /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two …Run Code Online (Sandbox Code Playgroud)