用cef Python打造自己的浏览器
2024-08-28 08:16:36
背景
项目需要做一个客户端的壳,内置浏览器,访问指定 的url
采用技术
- python3.5
- cefpython
https://github.com/cztomczak/cefpython#install
开始吧!
python环境配置省略
安装cefpython
pip install cefpython3==66.0
hello world
from cefpython3 import cefpython as cef
import platform
import sys
def main():
check_versions()
sys.excepthook = cef.ExceptHook # To shutdown all CEF processes on error
cef.Initialize()
cef.CreateBrowserSync(url="http://www.baidu.com",
window_title="Hello World!")
cef.MessageLoop()
cef.Shutdown()
def check_versions():
ver = cef.GetVersion()
print("[hello_world.py] CEF Python {ver}".format(ver=ver["version"]))
print("[hello_world.py] Chromium {ver}".format(ver=ver["chrome_version"]))
print("[hello_world.py] CEF {ver}".format(ver=ver["cef_version"]))
print("[hello_world.py] Python {ver} {arch}".format(
ver=platform.python_version(),
arch=platform.architecture()[0]))
assert cef.__version__ >= "57.0", "CEF Python v57.0+ required to run this"
if __name__ == '__main__':
main()
cef打包请查看
https://www.cnblogs.com/qingmiaokeji/p/10893915.html
效果
最新文章
- Execution Order of Event Functions
- 基于tomcat+spring+mysql搭建的个人博客
- Change Or Set Report Object Property At Run Time In Oracle Forms Using Set_Report_Object_Property Command
- hdu---(1280)前m大的数(计数排序)
- [转] ArcEngine 产生专题图
- HOG:从理论到OpenCV实践
- Django Web开发【6】使用Ajax增强用户体验
- uploadify在IE6下的问题
- ionic+AnjularJs实现省市县三级联动效果
- 个人附加作业XD --这门课终于结束了~~
- shell脚本-2
- vector.erase用法注意事项
- react+mobx 编写 withStoreHistory 装饰器
- Linux服务器---配置nfs
- 【题解】Luogu P1503 鬼子进村
- DevExpress WPF v18.2新版亮点(一)
- java 代码块,静态代码块,构造器等的执行顺序
- SQL Server 调优系列基础篇 - 常用运算符总结
- JavaScript验证注册信息
- Linux时间子系统(十二) periodic tick