当前位置: 首页>>代码示例>>Python>>正文


Python webview.create_window方法代码示例

本文整理汇总了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() 
开发者ID:r0x0r,项目名称:pywebview,代码行数:26,代码来源:test_multi_window.py

示例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}) 
开发者ID:r0x0r,项目名称:pywebview,代码行数:22,代码来源:test_localization.py

示例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) 
开发者ID:leapcode,项目名称:bitmask-dev,代码行数:5,代码来源:app2.py

示例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) 
开发者ID:leapcode,项目名称:bitmask-dev,代码行数:34,代码来源:app2.py

示例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") 
开发者ID:kolinger,项目名称:rd-usb,代码行数:16,代码来源:app.py

示例6: open

# 需要导入模块: import webview [as 别名]
# 或者: from webview import create_window [as 别名]
def open(self):
        webview.create_window(self.name, self.url) 
开发者ID:MycroftAI,项目名称:personal-backend,代码行数:4,代码来源:backend_gui.py

示例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>') 
开发者ID:r0x0r,项目名称:pywebview,代码行数:5,代码来源:multiple_windows.py

示例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) 
开发者ID:r0x0r,项目名称:pywebview,代码行数:5,代码来源:test_window.py

示例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) 
开发者ID:r0x0r,项目名称:pywebview,代码行数:5,代码来源:test_move_window.py

示例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) 
开发者ID:r0x0r,项目名称:pywebview,代码行数:5,代码来源:test_move_window.py

示例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) 
开发者ID:r0x0r,项目名称:pywebview,代码行数:5,代码来源:test_token.py

示例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) 
开发者ID:r0x0r,项目名称:pywebview,代码行数:5,代码来源:test_on_top.py

示例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) 
开发者ID:r0x0r,项目名称:pywebview,代码行数:6,代码来源:test_js_api.py

示例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 
开发者ID:r0x0r,项目名称:pywebview,代码行数:8,代码来源:test_js_api.py

示例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) 
开发者ID:r0x0r,项目名称:pywebview,代码行数:6,代码来源:test_js_api.py


注:本文中的webview.create_window方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。