首页 > 其他 > 详细

Text-鼠标点击事件

时间:2017-04-27 13:11:19      阅读:308      评论:0      收藏:0      [点我收藏+]
 1 from tkinter import *
 2 import webbrowser
 3 
 4 master=Tk()
 5 
 6 text=Text(master,width=50,height=20)
 7 text.pack()
 8 text.insert(INSERT,I love FishC.com!)
 9 text.tag_add(link,1.7,1.16)
10 text.tag_config(link,background=yellow,11                 foreground=blue,underline=True)
12 
13 def show_arrow_cursor(event):
14     text.config(cursor=arrow)
15     
16 def show_xterm_cursor(event):
17     text.config(cursor=xterm)
18     
19 def click(event):
20     webbrowser.open(http://www.fishc.com)
21     
22     
23 text.tag_bind(link,<Enter>,show_arrow_cursor)
24 text.tag_bind(link,<Leave>,show_xterm_cursor)
25 text.tag_bind(link,<Button-1>,click)
26 
27 
28 mainloop()

 

Text-鼠标点击事件

原文:http://www.cnblogs.com/themost/p/6773657.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!