# ch2_19.py
from tkinter import *
root = Tk()
root.title("ch2_19")
html_gif = PhotoImage(file="cartoon_birds.gif")
label=Label(root,image=html_gif)
label.pack()
root.mainloop()
# ch2_19_1.py
from tkinter import *
from PIL import Image, ImageTk
root = Tk()
root.title("ch2_19_1")
root.geometry("680x400")
image = Image.open("yellowstone.jpg")
yellowstone = ImageTk.PhotoImage(image)
label = Label(root,image=yellowstone)
label.pack()
root.mainloop()
THONNY -->工具 --> 管理外掛模組-->Pillow
安裝後執行還是會發生錯誤
>>> %Run ch2_19_1.py
Traceback (most recent call last):
File "D:\PythonGUI_20190513\ch2\ch2_19_1.py", line 3, in <module>
from PIL import Image, ImageTk
ModuleNotFoundError: No module named 'PIL'
沒有留言:
張貼留言