tkinter.PhotoImageを使ってキャンバスに画像を表示させたく、6行目のtikinter.Photoimage(file="")でjpegの拡張子の画像を入れたのですが失敗しました。他のpngの画像だったら問題なく表示できるのですが、これは単にtkinger.PhotoImageで表示できる拡張子の制限の問題でしょうか。
import tkinter root = tkinter.Tk() root.title("初めてのキャンパス") canvas = tkinter.Canvas(root,width = 600,height=600,bg = "white") canvas.pack() gazou = tkinter.PhotoImage(file = "C:/Users/kakio/OneDrive/画像/Panorama Hirsche auf der Wiese.jpeg") canvas.create_image(200,300,image=gazou) root.mainloop()
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。