import webbrowser
GEN_HTML = "tc.html" #命名弹窗网页
f = open(GEN_HTML,'w') #打开文件,准备写入
message = """
<html>
</head>
<title></title>
<meta charset = "utf-8">
<head>
<style type="text/css">
.words{font-size: 40px;
letter-spacing: 10px;
position: absolute;
top:50%;
left: 30%;}
.imgw{position: relative;}
</style>
</body>
<div class="imgw">
<img src="tr.jpg" alt = "" width="100%">
<div class="words">Youip:</div>
</div>
</body>
<html>"""
f.write(message) #写入文件
f.close() #关闭文件
webbrowser.open(GEN_HTML,new = 1) #运行完自动在网页显示
'''
webbrowser.open(url, new=0, autoraise=True)
Display url using the default browser. If new is 0, the url is ope
pythyon3+html图片上添加文字并弹出
最新推荐文章于 2021-12-05 12:47:01 发布