Python webview.create_window() Examples
The following are 30
code examples of webview.create_window().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
webview
, or try the search function
.
Example #1
Source File: test_multi_window.py From pywebview with BSD 3-Clause "New" or "Revised" License | 6 votes |
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()
Example #2
Source File: test_localization.py From pywebview with BSD 3-Clause "New" or "Revised" License | 6 votes |
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})
Example #3
Source File: test_expose.py From pywebview with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_expose_runtime(): window = webview.create_window('JSBridge test', html='<html><body>TEST</body></html>') run_test(webview, window, expose_runtime)
Example #4
Source File: test_multi_window.py From pywebview with BSD 3-Clause "New" or "Revised" License | 5 votes |
def js_bridge(window): class Api2: def test2(self): return 2 api2 = Api2() child_window = webview.create_window('Window #2', js_api=api2) assert child_window.uid != 'MainWindow' child_window.load_html('<html><body><h1>Secondary window</h1></body></html>') assert_js(window, 'test1', 1) assert_js(child_window, 'test2', 2) child_window.destroy()
Example #5
Source File: test_multi_window.py From pywebview with BSD 3-Clause "New" or "Revised" License | 5 votes |
def load_html(window): child_window = webview.create_window('Window #2', html='<body style="background: red;"><h1>Master Window</h1></body>') assert child_window != 'MainWindow' child_window.destroy()
Example #6
Source File: test_start.py From pywebview with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_start(): api = Api() window = webview.create_window('Relative URL test', 'assets/test.html', js_api=api) run_test(webview, window, assert_func)
Example #7
Source File: test_hide_window.py From pywebview with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_hide_show_window(): window = webview.create_window('Hide/show window test', 'https://www.example.org', hidden=True) run_test(webview, window, hide_show_window)
Example #8
Source File: test_fullscreen.py From pywebview with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_fullscreen(): window = webview.create_window('Fullscreen test', 'https://www.example.org', fullscreen=True) run_test(webview, window)
Example #9
Source File: test_frameless.py From pywebview with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_frameless(): window = webview.create_window('Frameless test', 'https://www.example.org', frameless=True) run_test(webview, window)
Example #10
Source File: test_expose.py From pywebview with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_expose_multiple(): window = webview.create_window('JSBridge test', html='<html><body>TEST</body></html>') window.expose(get_int, get_float) run_test(webview, window, expose_multiple)
Example #11
Source File: test_multi_window.py From pywebview with BSD 3-Clause "New" or "Revised" License | 5 votes |
def bg_color(window): child_window = webview.create_window('Window #2', background_color='#0000FF') assert child_window.uid != 'MainWindow' child_window.destroy()
Example #12
Source File: test_expose.py From pywebview with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_override(): api = Api() window = webview.create_window('JSBridge test', js_api=api) window.expose(get_int) run_test(webview, window, expose_override)
Example #13
Source File: test_min_size.py From pywebview with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_min_size(): window = webview.create_window('Min size test', 'https://www.example.org', min_size=(400, 200)) run_test(webview, window)
Example #14
Source File: test_load_html.py From pywebview with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_load_html(): window = webview.create_window('Load HTML test') run_test(webview, window, load_html)
Example #15
Source File: test_noresize.py From pywebview with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_noresize(): window = webview.create_window('Min size test', 'https://www.example.org', width=800, height=600, resizable=True, min_size=(400, 200)) run_test(webview, window)
Example #16
Source File: test_bg_color.py From pywebview with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_bg_color(): window = webview.create_window('Background color test', 'https://www.example.org', background_color='#0000FF') run_test(webview, window)
Example #17
Source File: test_bg_color.py From pywebview with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_invalid_bg_color(): with pytest.raises(ValueError): webview.create_window('Background color test', 'https://www.example.org', background_color='#dsg0000FF') with pytest.raises(ValueError): webview.create_window('Background color test', 'https://www.example.org', background_color='FF00FF') with pytest.raises(ValueError): webview.create_window('Background color test', 'https://www.example.org', background_color='#ac') with pytest.raises(ValueError): webview.create_window('Background color test', 'https://www.example.org', background_color='#EFEFEH') with pytest.raises(ValueError): webview.create_window('Background color test', 'https://www.example.org', background_color='#0000000')
Example #18
Source File: test_get_current_url.py From pywebview with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_current_url(): window = webview.create_window('Get Current URL test', 'https://example.org') run_test(webview, window, current_url_test, destroy_delay=5)
Example #19
Source File: test_get_current_url.py From pywebview with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_no_url(): window = webview.create_window('Get Current URL test') run_test(webview, window, no_url_test)
Example #20
Source File: server.py From remi with Apache License 2.0 | 5 votes |
def serve_forever(self): try: import webview except ImportError: raise ImportError('PyWebView is missing. Please install it by:\n ' 'pip install pywebview\n ' 'more info at https://github.com/r0x0r/pywebview') else: Server.start(self) webview.create_window(self.title, self.address, **self._application_conf) webview.start() Server.stop(self)
Example #21
Source File: test_js_api.py From pywebview with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_js_bridge(): api = Api() window = webview.create_window('JSBridge test', js_api=api) run_test(webview, window, js_bridge)
Example #22
Source File: app2.py From bitmask-dev with GNU General Public License v3.0 | 5 votes |
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)
Example #23
Source File: app.py From rd-usb with GNU General Public License v3.0 | 5 votes |
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")
Example #24
Source File: backend_gui.py From personal-backend with Apache License 2.0 | 5 votes |
def open(self): webview.create_window(self.name, self.url)
Example #25
Source File: multiple_windows.py From pywebview with BSD 3-Clause "New" or "Revised" License | 5 votes |
def third_window(): # Create a new window after the loop started third_window = webview.create_window('Window #3', html='<h1>Third Window</h1>')
Example #26
Source File: test_window.py From pywebview with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_window_count(): window = webview.create_window('Window object test') run_test(webview, window, window_count)
Example #27
Source File: test_move_window.py From pywebview with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_xy(): window = webview.create_window('xy test', x=200, y=200, width=100, height=100) run_test(webview, window, xy)
Example #28
Source File: test_move_window.py From pywebview with BSD 3-Clause "New" or "Revised" License | 5 votes |
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)
Example #29
Source File: test_token.py From pywebview with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_token(): window = webview.create_window('Token test') run_test(webview, window, token_test)
Example #30
Source File: test_on_top.py From pywebview with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_on_top(): window = webview.create_window("Toggle on_top test", "https://www.example.org") run_test(webview, window, on_top)