def create_window(title, url=None, width=800, height=600, resizable=True, fullscreen=False, min_size=(200, 100), strings={}, confirm_quit=False, background_color='#FFFFFF', debug=False): """ Create a web view window using a native GUI. The execution blocks after this function is invoked, so other program logic must be executed in a separate thread. :param title: Window title :param url: URL to load :param width: Optional window width (default: 800px) :param height: Optional window height (default: 600px) :param resizable True if window can be resized, False otherwise. Default is True :param fullscreen: True if start in fullscreen mode. Default is False :param min_size: a (width, height) tuple that specifies a minimum window size. Default is 200x100 :param strings: a dictionary with localized strings :param confirm_quit: Display a quit confirmation dialog. Default is False :param background_color: Background color as a hex string that is displayed before the content of webview is loaded. Default is white. :return: """ valid_color = r'^#(?:[0-9a-fA-F]{3}){1,2}$' if not re.match(valid_color, background_color): raise ValueError('{0} is not a valid hex triplet color'.format(background_color)) _initialize_imports() localization.update(strings) gui.create_window(_make_unicode(title), _transform_url(url), width, height, resizable, fullscreen, min_size, confirm_quit, background_color, debug, _webview_ready)
def create_window(title, url=None, width=800, height=600, resizable=True, fullscreen=False, min_size=(200, 100), strings={}, confirm_quit=False): """ Create a web view window using a native GUI. The execution blocks after this function is invoked, so other program logic must be executed in a separate thread. :param title: Window title :param url: URL to load :param width: Optional window width (default: 800px) :param height: Optional window height (default: 600px) :param resizable True if window can be resized, False otherwise. Default is True :param fullscreen: True if start in fullscreen mode. Default is False :param min_size: a (width, height) tuple that specifies a minimum window size. Default is 200x100 :param strings: a dictionary with localized strings :return: """ _initialize_imports() localization.update(strings) gui.create_window(_make_unicode(title), _transform_url(url), width, height, resizable, fullscreen, min_size, confirm_quit, _webview_ready)
def create_window(title, url=None, js_api=None, width=800, height=600, resizable=True, fullscreen=False, min_size=(200, 100), strings={}, confirm_quit=False, background_color='#FFFFFF', text_select=False, debug=False): """ Create a web view window using a native GUI. The execution blocks after this function is invoked, so other program logic must be executed in a separate thread. :param title: Window title :param url: URL to load :param width: window width. Default is 800px :param height:window height. Default is 600px :param resizable True if window can be resized, False otherwise. Default is True :param fullscreen: True if start in fullscreen mode. Default is False :param min_size: a (width, height) tuple that specifies a minimum window size. Default is 200x100 :param strings: a dictionary with localized strings :param confirm_quit: Display a quit confirmation dialog. Default is False :param background_color: Background color as a hex string that is displayed before the content of webview is loaded. Default is white. :param text_select: Allow text selection on page. Default is False. :return: The uid of the created window. """ valid_color = r'^#(?:[0-9a-fA-F]{3}){1,2}$' if not re.match(valid_color, background_color): raise ValueError( '{0} is not a valid hex triplet color'.format(background_color)) # Check if starting up from main thread; if not, wait; finally raise exception if current_thread().name == 'MainThread': uid = 'master' if not _initialized: _initialize_imports() localization.update(strings) else: uid = 'child_' + uuid4().hex[:8] if not _webview_ready.wait(5): raise Exception( 'Call create_window from the main thread first, and then from subthreads' ) _webview_ready.clear( ) # Make API calls wait while the new window is created gui.create_window(uid, make_unicode(title), transform_url(url), width, height, resizable, fullscreen, min_size, confirm_quit, background_color, debug, js_api, text_select, _webview_ready) return uid
def create_window(title, url, width=800, height=600, resizable=True, fullscreen=False): """ Create a web view window using a native GUI. The execution blocks after this function is invoked, so other program logic must be executed in a separate thread. :param title: Window title :param url: URL to load :param width: Optional window width (default: 800px) :param height: Optional window height (default: 600px) :param resizable True if window can be resized, False otherwise. Default is True. :return: """ gui.create_window(_make_unicode(title), _transform_url(url), width, height, resizable, fullscreen)