码迷,mamicode.com
首页 > 编程语言 > 详细

pythonGUI编程打开默认浏览器

时间:2017-08-05 15:37:49      阅读:258      评论:0      收藏:0      [点我收藏+]

标签:ges   技术分享   nbsp   编程   png   img   reg   row   add   

代码:

from tkinter import *
import webbrowser

root = Tk()

text = Text(root,width=30,height = 5)
text.pack()

text.insert(INSERT, "百度一下,你就知道")

text.tag_add("link","1.0","1.4")
text.tag_config("link", foreground="blue", underline = True)

def click(event):
    webbrowser.open("http://www.baidu.com")

text.tag_bind("link","<Button-1>",click)

mainloop()

运行图:

技术分享

 

pythonGUI编程打开默认浏览器

标签:ges   技术分享   nbsp   编程   png   img   reg   row   add   

原文地址:http://www.cnblogs.com/ncuhwxiong/p/7290282.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!