Text-插入图片

 1 #text插入图片
 2 from tkinter import *
 3 
 4 master=Tk()
 5 
 6 text=Text(master,width=50,height=50)
 7 text.pack()
 8 
 9 photo=PhotoImage(file='/Users/wangguangjie/Downloads/fishc.gif')
10 def show():
11     text.image_create(END,image=photo)
12 
13 b = Button(master,text='插入图片',command=show)
14 #INSERT索引表示插入光标当前的位置
15 text.window_create(INSERT,window=b)
16 
17 mainloop()

 

posted @ 2017-04-26 21:56  道高一尺  阅读(595)  评论(0编辑  收藏  举报