本文整理汇总了Python中webview.create_window方法的典型用法代码示例。如果您正苦于以下问题:Python webview.create_window方法的具体用法?Python webview.create_window怎么用?Python webview.create_window使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webview
的用法示例。
在下文中一共展示了webview.create_window方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: evaluate_js
# 需要导入模块: import webview [as 别名]
# 或者: from webview import create_window [as 别名]
def evaluate_js(window):
child_window = webview.create_window('Window #2', 'https://google.com')
assert child_window.uid != 'MainWindow'
result1 = window.evaluate_js("""
document.body.style.backgroundColor = '#212121';
// comment
function test() {
return 2 + 5;
}
test();
""")
assert result1 == 7
result2 = child_window.evaluate_js("""
document.body.style.backgroundColor = '#212121';
// comment
function test() {
return 2 + 2;
}
test();
""")
assert result2 == 4
child_window.destroy()
示例2: test_localization
# 需要导入模块: import webview [as 别名]
# 或者: from webview import create_window [as 别名]
def test_localization():
localization = {
'cocoa.menu.about': u'О программе',
'cocoa.menu.services': u'Cлужбы',
'cocoa.menu.view': u'Вид',
'cocoa.menu.hide': u'Скрыть',
'cocoa.menu.hideOthers': u'Скрыть остальные',
'cocoa.menu.showAll': u'Показать все',
'cocoa.menu.quit': u'Завершить',
'cocoa.menu.fullscreen': u'Полнж',
'windows.fileFilter.allFiles': u'Все файлы',
'windows.fileFilter.otherFiles': u'Остальлные файльы',
'linux.openFile': u'Открыть файл',
'linux.openFiles': u'Открыть файлы',
'linux.openFolder': u'Открыть папку',
'linux.saveFile': u'Сохранить файл',
}
window = webview.create_window('Localization test', 'https://www.example.org')
run_test(webview, window, start_args={'localization': localization})
示例3: create_window
# 需要导入模块: import webview [as 别名]
# 或者: from webview import create_window [as 别名]
def create_window(self):
# blocks. So this should be the last action you do during launch.
webview.create_window('Bitmask', self.url)
示例4: launch_gui
# 需要导入模块: import webview [as 别名]
# 或者: from webview import create_window [as 别名]
def launch_gui():
launch_backend()
# there are some tricky movements here to synchronize
# the different closing events:
# 1. bitmask off button: proper way, does shutdown via js.
# 2. systray quit: calls browser.shutdown() via reference.
# 3. browser window close: has to call browser.shutdown() explicitely.
try:
systray = launch_systray()
browser = BrowserWindow(None)
systray.browser = browser
browser.create_window()
# here control is passed
# to the pywebview event loop...
# case 2.
if not browser.closing:
browser.shutdown()
systray.browser = None
# close systray if closed from cases 1. or 2.
systray.closeFromSystray()
sys.exit(qApp.exec_())
except NoAuthTokenError as e:
print('ERROR: ' + e.message)
sys.exit(1)
示例5: start
# 需要导入模块: import webview [as 别名]
# 或者: from webview import create_window [as 别名]
def start(self):
Thread(target=self.handle_callback, daemon=True).start()
parameters = self.window_parameters
if self.title:
parameters["title"] = self.title
if self.width:
parameters["width"] = self.width
if self.height:
parameters["height"] = self.height
self.window = webview.create_window(html=self.loading_html, **parameters)
self.window.loaded += self.on_loaded
webview.start(debug=debug, gui="cef")
示例6: open
# 需要导入模块: import webview [as 别名]
# 或者: from webview import create_window [as 别名]
def open(self):
webview.create_window(self.name, self.url)
示例7: third_window
# 需要导入模块: import webview [as 别名]
# 或者: from webview import create_window [as 别名]
def third_window():
# Create a new window after the loop started
third_window = webview.create_window('Window #3', html='<h1>Third Window</h1>')
示例8: test_window_count
# 需要导入模块: import webview [as 别名]
# 或者: from webview import create_window [as 别名]
def test_window_count():
window = webview.create_window('Window object test')
run_test(webview, window, window_count)
示例9: test_xy
# 需要导入模块: import webview [as 别名]
# 或者: from webview import create_window [as 别名]
def test_xy():
window = webview.create_window('xy test', x=200, y=200, width=100, height=100)
run_test(webview, window, xy)
示例10: test_move_window
# 需要导入模块: import webview [as 别名]
# 或者: from webview import create_window [as 别名]
def test_move_window():
window = webview.create_window('Move window test', x=200, y=200, width=100, height=100)
run_test(webview, window, move_window)
示例11: test_token
# 需要导入模块: import webview [as 别名]
# 或者: from webview import create_window [as 别名]
def test_token():
window = webview.create_window('Token test')
run_test(webview, window, token_test)
示例12: test_on_top
# 需要导入模块: import webview [as 别名]
# 或者: from webview import create_window [as 别名]
def test_on_top():
window = webview.create_window("Toggle on_top test", "https://www.example.org")
run_test(webview, window, on_top)
示例13: test_js_bridge
# 需要导入模块: import webview [as 别名]
# 或者: from webview import create_window [as 别名]
def test_js_bridge():
api = Api()
window = webview.create_window('JSBridge test', js_api=api)
run_test(webview, window, js_bridge)
示例14: test_exception
# 需要导入模块: import webview [as 别名]
# 或者: from webview import create_window [as 别名]
def test_exception():
api = Api()
window = webview.create_window('JSBridge test', js_api=api)
run_test(webview, window, exception)
# This test randomly fails on Windows
示例15: test_concurrent
# 需要导入模块: import webview [as 别名]
# 或者: from webview import create_window [as 别名]
def test_concurrent():
api = Api()
window = webview.create_window('JSBridge test', js_api=api)
run_test(webview, window, concurrent)