开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (13)
标签 (29)
master
dev
cefpython66
cefpython49-winxp
cefpython58
cefpython57
cefpython56
cefpython55
cefpython54
cefpython53
cefpython52
cefpython51
cefpython31
v66.1
v49.0
v49-upstream
v66.0
v66-upstream
v57.1
v58.0-win32
v57.0
v57-upstream
v56.2
v56.1
v56.0-win
v56-upstream
v56.0
v55.4
v55.3
v55.2
v54.1
v55-upstream
v55.1
master
分支 (13)
标签 (29)
master
dev
cefpython66
cefpython49-winxp
cefpython58
cefpython57
cefpython56
cefpython55
cefpython54
cefpython53
cefpython52
cefpython51
cefpython31
v66.1
v49.0
v49-upstream
v66.0
v66-upstream
v57.1
v58.0-win32
v57.0
v57-upstream
v56.2
v56.1
v56.0-win
v56-upstream
v56.0
v55.4
v55.3
v55.2
v54.1
v55-upstream
v55.1
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (13)
标签 (29)
master
dev
cefpython66
cefpython49-winxp
cefpython58
cefpython57
cefpython56
cefpython55
cefpython54
cefpython53
cefpython52
cefpython51
cefpython31
v66.1
v49.0
v49-upstream
v66.0
v66-upstream
v57.1
v58.0-win32
v57.0
v57-upstream
v56.2
v56.1
v56.0-win
v56-upstream
v56.0
v55.4
v55.3
v55.2
v54.1
v55-upstream
v55.1
sample2.py 4.17 KB
一键复制 编辑 原始数据 按行查看 历史
# Slightly more advanced sample illustrating the usage of CEFWindow class.
# On Mac the cefpython library must be imported the very first,
# before any other libraries (Issue 155).
import cefpython3.wx.chromectrl as chrome
# TODO: There is something wrong happening on Linux. CPU usage
# for the python process is 100% all the time. This problem
# does not occur on Windows, nor in sample1.py/sample3.py.
# It must have something to do with invalid usage of the wx
# controls in this example.
import wx
import wx.lib.agw.flatnotebook as fnb
import platform
import sys
ROOT_NAME = "My Locations"
URLS = ["http://gmail.com",
"http://maps.google.com",
"http://youtube.com",
"http://yahoo.com",
"http://wikipedia.com",
"http://cyaninc.com",
"http://tavmjong.free.fr/INKSCAPE/MANUAL/web/svg_tests.php"
]
class MainFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, parent=None, id=wx.ID_ANY,
title='cefwx example2', size=(800, 600))
self.initComponents()
self.layoutComponents()
self.initEventHandlers()
if len(sys.argv) == 2 and sys.argv[1] == "test-launch":
wx.CallLater(500, self.testLaunch)
def testLaunch(self):
# This hash is checked by /tests/test-launch.sh script
# to detect whether CEF initialized successfully.
print("b8ba7d9945c22425328df2e21fbb64cd")
self.Close()
def initComponents(self):
self.tree = wx.TreeCtrl(self, id=-1, size=(200, -1))
self.root = self.tree.AddRoot(ROOT_NAME)
for url in URLS:
self.tree.AppendItem(self.root, url)
self.tree.Expand(self.root)
self.tabs = fnb.FlatNotebook(self, wx.ID_ANY,
agwStyle=fnb.FNB_NODRAG | fnb.FNB_X_ON_TAB)
# You also have to set the wx.WANTS_CHARS style for
# all parent panels/controls, if it's deeply embedded.
self.tabs.SetWindowStyleFlag(wx.WANTS_CHARS)
def layoutComponents(self):
sizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.Add(self.tree, 0, wx.EXPAND)
sizer.Add(self.tabs, 1, wx.EXPAND)
self.SetSizer(sizer)
def initEventHandlers(self):
self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelChanged, self.tree)
self.Bind(fnb.EVT_FLATNOTEBOOK_PAGE_CLOSING, self.OnPageClosing)
self.Bind(wx.EVT_CLOSE, self.OnClose)
def OnSelChanged(self, event):
self.item = event.GetItem()
url = self.tree.GetItemText(self.item)
if url and url != ROOT_NAME:
cefPanel = chrome.ChromeCtrl(self.tabs, useTimer=True, url=str(url))
self.tabs.AddPage(cefPanel, url)
self.tabs.SetSelection(self.tabs.GetPageCount()-1)
event.Skip()
def OnPageClosing(self, event):
print("sample2.py: One could place some extra closing stuff here")
event.Skip()
def OnClose(self, event):
# Remember to destroy all CEF browser references before calling
# Destroy(), so that browser closes cleanly. In this specific
# example there are no references kept, but keep this in mind
# for the future.
self.Destroy()
# On Mac the code after app.MainLoop() never executes, so
# need to call CEF shutdown here.
if platform.system() == "Darwin":
chrome.Shutdown()
wx.GetApp().Exit()
class MyApp(wx.App):
def OnInit(self):
frame = MainFrame()
self.SetTopWindow(frame)
frame.Show()
return True
if __name__ == '__main__':
chrome.Initialize()
if platform.system() == "Linux":
# CEF initialization fails intermittently on Linux during
# launch of a subprocess (Issue 131). The solution is
# to offload cpu for half a second after Initialize
# has returned (it still runs some stuff in its thread).
import time
time.sleep(0.5)
print('sample2.py: wx.version=%s' % wx.version())
app = MyApp(False)
app.MainLoop()
# Important: do the wx cleanup before calling Shutdown
del app
# On Mac Shutdown is called in OnClose
if platform.system() in ["Linux", "Windows"]:
chrome.Shutdown()
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

ddsdsd
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/aoplxml/cefpython.git
git@gitee.com:aoplxml/cefpython.git
aoplxml
cefpython
cefpython
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /