|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
from tkinter import *
import urllib.request
import os
root = Tk()
text = Text(root,width = 30,height = 30)
text.pack()
text.insert(INSERT,"快点击这里啊<click>")
text.tag_add("come here",1.7,1.12)
text.tag_config("come here", foreground="blue",underline = True)
def enter(event):
text.config(cursor = "arrow")
def leave(event):
text.config(cursor = "xterm")
def click(event):
os.chdir("C:\\users\\david\\Desktop")
photo = PhotoImage(file = "qq.gif")
text.image_create(END,image= photo)
text.tag_bind("come here","<Enter>",enter)
text.tag_bind("come here","<Leave>",leave)
text.tag_bind("come here","<Button-1>",click)
mainloop()
路径是对的,但为什么会发生tkinter.TclError: couldn't recognize data in image file "qq.gif",不是说PhotoImage能认得出gif的图片吗? |
|