tkinter笔记六

图像(Images)

gifdir = "D:\MYhtml"    #图片文件夹
from tkinter import *
win = Tk()
igm = PhotoImage(file=gifdir + "\my.gif")
Button(win, image=igm).pack()
win.mainloop()

gifdir = "D:\MYhtml"
from tkinter import *
win = Tk()
img = PhotoImage(file=gifdir + "\my.gif")
can = Canvas(win)
can.pack(fill=BOTH)
can.create_image(100, 100, image=img, anchor=NW) # x, y coordinates x,y坐标
win.mainloop()

未完...

你可能感兴趣的:(tkinter笔记六)