def create_window(title, url=None, html=None, js_api=None, width=800, height=600, x=None, y=None, resizable=True, fullscreen=False, min_size=(200, 100), hidden=False, frameless=False, easy_drag=True, minimized=False, on_top=False, confirm_close=False, background_color='#FFFFFF', transparent=False, text_select=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 hidden: Whether the window should be hidden. :param frameless: Whether the window should have a frame. :param easy_drag: Easy window drag mode when window is frameless. :param minimized: Display window minimized :param on_top: Keep window above other windows (required OS: Windows) :param confirm_close: Display a window close 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. :param transparent: Don't draw window background. :return: window object. """ 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)) uid = 'master' if len(windows) == 0 else 'child_' + uuid4().hex[:8] window = Window(uid, make_unicode(title), url, html, width, height, x, y, resizable, fullscreen, min_size, hidden, frameless, easy_drag, minimized, on_top, confirm_close, background_color, js_api, text_select, transparent) windows.append(window) if threading.current_thread().name != 'MainThread' and guilib: window._initialize(guilib, _multiprocessing, _http_server) guilib.create_window(window) return window
def show_inspector(self): uid = self.parent().uid + '-inspector' try: # If inspector already exists, bring it to the front BrowserView.instances[uid].raise_() BrowserView.instances[uid].activateWindow() except KeyError: title = 'Web Inspector - {}'.format(self.parent().title) url = 'http://localhost:{}'.format(BrowserView.inspector_port) print(url) window = Window('web_inspector', title, url, '', 700, 500, None, None, True, False, (300, 200), False, False, False, False, False, False, '#fff', None, False, False, None) window.localization = self.parent().localization inspector = BrowserView(window) inspector.show()