tkinter-WebView2 widget, based on WebView2.Core
Project description
tkwebview2
tkinter浏览器-网页组件,tkwebview2登场!!!
基于pythonnet-webview绑定和WebView2.Core,将受到微软WebView2的持续改进支持,外观和效能相比tkinterie
得到大幅度改进。
依赖
以下是tkwebview2
的依赖库:
- pythonnet(clr)
- pywebview(webview)
使用方法
WebView2(master,width:int,height:int,url:str='',**kw)
'''
master::父组件
width::初始宽度
height::初始高度
url::网址或html文件,可以为空
**kw::其它Frame参数
'''
例子:
from tkinter import Tk
from tkwebview2 import WebView2
root=Tk()
root.title('pywebview for tkinter test')
root.geometry('1200x600+5+5')
frame=WebView2(root,500,500)
frame.load_html('<h1>hi hi hi</h1>')
frame.pack(side='left')
frame2=WebView2(root,500,500)
frame2.load_url('https://smart-space.com.cn/')
frame2.pack(side='right',fill='x',expand=True)
root.mainloop()
方法
get_url()
返回当前url。
evaluate_js(self,script)
执行JavaScript代码,并返回最终结果。
load_css(self,css)
加载CSS样式。
load_html(self,content,base_uri=None)
加载HTML代码,base_uri
为基本URL,默认为本程序启动目录。
load_url(self,url)
加载全新url。
What's new
-1.0.0-
Upload to PYPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for tkwebview2-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba5438f12e7acd251deb807ffa440b1228dc2e670e37d79fe5552ce5b33ba1a6 |
|
MD5 | e746d7002ce249c8eee7dd46c7082712 |
|
BLAKE2b-256 | 4b7cf88a138c2cfe3325070ee8caa61e68ecf4aeec2dda26bc4603555b75f982 |