标签:imp main back com pac bin from yellow button
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()
标签:imp main back com pac bin from yellow button
原文地址:http://www.cnblogs.com/themost/p/6773657.html