1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>API | pywebview (v2.4)</title>
<meta name="description" content="Build GUI for your Python program with JavaScript, HTML, and CSS">
<link rel="preload" href="/2.4/assets/css/0.styles.e542dfbb.css" as="style"><link rel="preload" href="/2.4/assets/js/app.ab883ad2.js" as="script"><link rel="preload" href="/2.4/assets/js/31.c651468e.js" as="script"><link rel="prefetch" href="/2.4/assets/js/10.946430c0.js"><link rel="prefetch" href="/2.4/assets/js/11.9f37de77.js"><link rel="prefetch" href="/2.4/assets/js/12.cc649247.js"><link rel="prefetch" href="/2.4/assets/js/13.94ca571d.js"><link rel="prefetch" href="/2.4/assets/js/14.a047eef4.js"><link rel="prefetch" href="/2.4/assets/js/15.788bb271.js"><link rel="prefetch" href="/2.4/assets/js/16.694894b2.js"><link rel="prefetch" href="/2.4/assets/js/17.2edfeaf2.js"><link rel="prefetch" href="/2.4/assets/js/18.7b4619dc.js"><link rel="prefetch" href="/2.4/assets/js/19.ec102f84.js"><link rel="prefetch" href="/2.4/assets/js/2.06af3526.js"><link rel="prefetch" href="/2.4/assets/js/20.b1804ec3.js"><link rel="prefetch" href="/2.4/assets/js/21.82f7ca23.js"><link rel="prefetch" href="/2.4/assets/js/22.0e759d36.js"><link rel="prefetch" href="/2.4/assets/js/23.8e7b242c.js"><link rel="prefetch" href="/2.4/assets/js/24.720f51e9.js"><link rel="prefetch" href="/2.4/assets/js/25.3af86868.js"><link rel="prefetch" href="/2.4/assets/js/26.562c94d4.js"><link rel="prefetch" href="/2.4/assets/js/27.7c95cefd.js"><link rel="prefetch" href="/2.4/assets/js/28.d5836b93.js"><link rel="prefetch" href="/2.4/assets/js/29.528821ab.js"><link rel="prefetch" href="/2.4/assets/js/3.c462cbf1.js"><link rel="prefetch" href="/2.4/assets/js/30.e6e32fda.js"><link rel="prefetch" href="/2.4/assets/js/32.6c8529fe.js"><link rel="prefetch" href="/2.4/assets/js/33.96fe48c6.js"><link rel="prefetch" href="/2.4/assets/js/34.1503f1f8.js"><link rel="prefetch" href="/2.4/assets/js/35.2c565ae8.js"><link rel="prefetch" href="/2.4/assets/js/36.60799f3e.js"><link rel="prefetch" href="/2.4/assets/js/37.5656488c.js"><link rel="prefetch" href="/2.4/assets/js/38.30116eb6.js"><link rel="prefetch" href="/2.4/assets/js/39.8b7a8ec5.js"><link rel="prefetch" href="/2.4/assets/js/4.cc18902f.js"><link rel="prefetch" href="/2.4/assets/js/40.14c37596.js"><link rel="prefetch" href="/2.4/assets/js/5.b85830ed.js"><link rel="prefetch" href="/2.4/assets/js/6.fe285e19.js"><link rel="prefetch" href="/2.4/assets/js/7.5eeb60d8.js"><link rel="prefetch" href="/2.4/assets/js/8.b9ad99cd.js"><link rel="prefetch" href="/2.4/assets/js/9.6a770a26.js">
<link rel="stylesheet" href="/2.4/assets/css/0.styles.e542dfbb.css">
</head>
<body>
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/2.4/" class="home-link router-link-active"><!----> <span class="site-name">pywebview (v2.4)</span></a> <div class="links" style="max-width:nullpx;"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/2.4/guide/" class="nav-link router-link-active">Guide</a></div><div class="nav-item"><a href="/2.4/examples/" class="nav-link">Examples</a></div><div class="nav-item"><a href="/2.4/contributing/" class="nav-link">Contributing</a></div><div class="nav-item"><a href="https://pywebview.flowrl.com/" target="_blank" rel="noopener noreferrer" class="nav-link external">
Current version
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div><div class="nav-item"><a href="https://github.com/r0x0r/pywebview/blob/master/CHANGELOG.md" target="_blank" rel="noopener noreferrer" class="nav-link external">
Changelog
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <a href="https://github.com/r0x0r/pywebview" target="_blank" rel="noopener noreferrer" class="repo-link">
GitHub
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></nav></div></header> <div class="sidebar-mask"></div> <div class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/2.4/guide/" class="nav-link router-link-active">Guide</a></div><div class="nav-item"><a href="/2.4/examples/" class="nav-link">Examples</a></div><div class="nav-item"><a href="/2.4/contributing/" class="nav-link">Contributing</a></div><div class="nav-item"><a href="https://pywebview.flowrl.com/" target="_blank" rel="noopener noreferrer" class="nav-link external">
Current version
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div><div class="nav-item"><a href="https://github.com/r0x0r/pywebview/blob/master/CHANGELOG.md" target="_blank" rel="noopener noreferrer" class="nav-link external">
Changelog
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <a href="https://github.com/r0x0r/pywebview" target="_blank" rel="noopener noreferrer" class="repo-link">
GitHub
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></nav> <ul class="sidebar-links"><li><div class="sidebar-group first"><p class="sidebar-heading"><span>Basics</span> <!----></p> <ul class="sidebar-group-items"><li><a href="/2.4/guide/installation.html" class="sidebar-link">Installation</a></li><li><a href="/2.4/guide/usage.html" class="sidebar-link">Usage</a></li></ul></div></li><li><div class="sidebar-group"><p class="sidebar-heading open"><span>Development</span> <!----></p> <ul class="sidebar-group-items"><li><a href="/2.4/guide/api.html" class="active sidebar-link">API</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/2.4/guide/api.html#create-window" class="sidebar-link">create_window</a></li><li class="sidebar-sub-header"><a href="/2.4/guide/api.html#create-file-dialog" class="sidebar-link">createfiledialog</a></li><li class="sidebar-sub-header"><a href="/2.4/guide/api.html#destroy-window" class="sidebar-link">destroy_window</a></li><li class="sidebar-sub-header"><a href="/2.4/guide/api.html#evaluate-js" class="sidebar-link">evaluate_js</a></li><li class="sidebar-sub-header"><a href="/2.4/guide/api.html#get-current-url" class="sidebar-link">getcurrenturl</a></li><li class="sidebar-sub-header"><a href="/2.4/guide/api.html#load-css" class="sidebar-link">load_css</a></li><li class="sidebar-sub-header"><a href="/2.4/guide/api.html#load-html" class="sidebar-link">load_html</a></li><li class="sidebar-sub-header"><a href="/2.4/guide/api.html#load-url" class="sidebar-link">load_url</a></li><li class="sidebar-sub-header"><a href="/2.4/guide/api.html#set-title" class="sidebar-link">set_title</a></li><li class="sidebar-sub-header"><a href="/2.4/guide/api.html#toggle-fullscreen" class="sidebar-link">toggle_fullscreen</a></li><li class="sidebar-sub-header"><a href="/2.4/guide/api.html#window-exists" class="sidebar-link">window_exists</a></li><li class="sidebar-sub-header"><a href="/2.4/guide/api.html#config" class="sidebar-link">config</a></li></ul></li><li><a href="/2.4/guide/architecture.html" class="sidebar-link">Application architecture</a></li><li><a href="/2.4/guide/debugging.html" class="sidebar-link">Debugging</a></li><li><a href="/2.4/guide/freezing.html" class="sidebar-link">Freezing</a></li><li><a href="/2.4/guide/security.html" class="sidebar-link">Security</a></li><li><a href="/2.4/guide/virtualenv.html" class="sidebar-link">Virtual environment</a></li><li><a href="/2.4/guide/renderer.html" class="sidebar-link">Web engine</a></li></ul></div></li></ul> </div> <div class="page"> <div class="content"><h1 id="api"><a href="#api" aria-hidden="true" class="header-anchor">#</a> API</h1> <h2 id="create-window"><a href="#create-window" aria-hidden="true" class="header-anchor">#</a> create_window</h2> <div class="language-python extra-class"><pre class="language-python"><code>create_window<span class="token punctuation">(</span>title<span class="token punctuation">,</span> url<span class="token operator">=</span><span class="token string">''</span><span class="token punctuation">,</span> js_api<span class="token operator">=</span><span class="token boolean">None</span><span class="token punctuation">,</span> width<span class="token operator">=</span><span class="token number">800</span><span class="token punctuation">,</span> height<span class="token operator">=</span><span class="token number">600</span><span class="token punctuation">,</span> resizable<span class="token operator">=</span><span class="token boolean">True</span><span class="token punctuation">,</span>\
fullscreen<span class="token operator">=</span><span class="token boolean">False</span><span class="token punctuation">,</span> min_size<span class="token operator">=</span><span class="token punctuation">(</span><span class="token number">200</span><span class="token punctuation">,</span> <span class="token number">100</span><span class="token punctuation">)</span><span class="token punctuation">,</span> strings<span class="token operator">=</span><span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span> confirm_quit<span class="token operator">=</span><span class="token boolean">False</span><span class="token punctuation">,</span> \
background_color<span class="token operator">=</span><span class="token string">'#FFF'</span><span class="token punctuation">,</span> debug<span class="token operator">=</span><span class="token boolean">False</span><span class="token punctuation">,</span> text_select<span class="token operator">=</span><span class="token boolean">False</span><span class="token punctuation">)</span>
</code></pre></div><p>Create a new <em>pywebview</em> window. Calling this function for the first time will start the application and block program execution. You have to execute your program logic in a separate thread. Subsequent calls to <code>create_window</code> will return a unique window <code>uid</code>, which can be used to refer to the specific window in the API functions. Single-window applications need not bother about the <code>uid</code> and can simply omit it from function calls.</p> <ul><li><code>title</code> - Window title</li> <li><code>url</code> - URL to load. If the URL does not have a protocol prefix, it is resolved as a path relative to the application entry point.</li> <li><code>js_api</code> - Expose a <code>js_api</code> class object to the DOM of the current <code>pywebview</code> window. Callable functions of <code>js_api</code> can be executed using Javascript page via <code>window.pywebview.api</code> object. Custom functions accept a single parameter, either a primitive type or an object. Object types are converted between Javascript and Python. Functions are executed in separate
threads and are not thread-safe. <code>window.pywebview</code> is not guaranteed to be available on <code>window.onload</code> and its access must be deferred.</li> <li><code>width</code> - Window width. Default is 800px.</li> <li><code>height</code> - Window height. Default is 600px.</li> <li><code>resizable</code> - Whether window can be resized. Default is True</li> <li><code>fullscreen</code> - Whether to start in fullscreen mode. Default is False</li> <li><code>min_size</code> - a (width, height) tuple that specifies a minimum window size. Default is 200x100</li> <li><code>strings</code> - a dictionary with localized strings. Default strings and their keys are defined in localization.py</li> <li><code>confirm_quit</code> - Whether to display a quit confirmation dialog. Default is False</li> <li><code>background_color</code> - Background color of the window displayed before WebView is loaded. Specified as a hex color. Default is white.</li> <li><code>debug</code> - Enabled debug mode. See <a href="/2.4/guide/debugging.html">debugging</a> for details</li> <li><code>text_select</code> - Enables document text selection. Default is False. To control text selection on per element basis, use <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/user-select" target="_blank" rel="noopener noreferrer">user-select<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> CSS property.</li></ul> <p>The functions below must be invoked after a <em>pywebview</em> window is created, otherwise an exception is thrown.
In all cases, <code>uid</code> is the uid of the target window returned by <code>create_window()</code>; if no window exists with the given <code>uid</code>, an exception is thrown. Default is <code>'master'</code>, which is the special uid given to the first window.</p> <h3 id="examples"><a href="#examples" aria-hidden="true" class="header-anchor">#</a> Examples</h3> <ul><li><a href="/2.4/examples/open_url.html">Simple window</a></li> <li><a href="/2.4/examples/multiple_windows.html">Multi-window</a></li></ul> <h2 id="create-file-dialog"><a href="#create-file-dialog" aria-hidden="true" class="header-anchor">#</a> create_file_dialog</h2> <div class="language-python extra-class"><pre class="language-python"><code>create_file_dialog<span class="token punctuation">(</span>dialog_type<span class="token operator">=</span>OPEN_DIALOG<span class="token punctuation">,</span> directory<span class="token operator">=</span><span class="token string">''</span><span class="token punctuation">,</span> allow_multiple<span class="token operator">=</span><span class="token boolean">False</span><span class="token punctuation">,</span> save_filename<span class="token operator">=</span><span class="token string">''</span><span class="token punctuation">,</span> file_types<span class="token operator">=</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>`
</code></pre></div><p>Create an open file (<code>webview.OPEN_DIALOG</code>), open folder (<code>webview.FOLDER_DIALOG</code>) or save file (<code>webview.SAVE_DIALOG</code>) dialog.</p> <p>Return a tuple of selected files, None if cancelled.</p> <ul><li><code>allow_multiple=True</code> enables multiple selection.</li> <li><code>directory</code> Initial directory.</li> <li><code>save_filename</code> Default filename for save file dialog.</li> <li><code>file_types</code> A tuple of supported file type strings in the open file dialog. A file type string must follow this format <code>"Description (*.ext1;*.ext2...)"</code>.</li></ul> <p>If the argument is not specified, then the <code>"All files (*.*)"</code> mask is used by default. The 'All files' string can be changed in the localization dictionary.</p> <h3 id="examples-2"><a href="#examples-2" aria-hidden="true" class="header-anchor">#</a> Examples</h3> <ul><li><a href="/2.4/examples/open_file_dialog.html">Open-file dialog</a></li> <li><a href="/2.4/examples/save_file_dialog.html">Save-file dialog</a></li></ul> <h2 id="destroy-window"><a href="#destroy-window" aria-hidden="true" class="header-anchor">#</a> destroy_window</h2> <div class="language-python extra-class"><pre class="language-python"><code>destroy_window<span class="token punctuation">(</span>uid<span class="token operator">=</span><span class="token string">'master'</span><span class="token punctuation">)</span>
</code></pre></div><p>Destroy the specified WebView window.</p> <p><a href="/2.4/examples/destroy_window.html">Example</a></p> <h2 id="evaluate-js"><a href="#evaluate-js" aria-hidden="true" class="header-anchor">#</a> evaluate_js</h2> <div class="language-python extra-class"><pre class="language-python"><code>evaluate_js<span class="token punctuation">(</span>script<span class="token punctuation">,</span> uid<span class="token operator">=</span><span class="token string">'master'</span><span class="token punctuation">)</span>
</code></pre></div><p>Execute Javascript code in the specified window. The last evaluated expression is returned. Javascript types are converted to Python types, eg. JS objects to dicts, arrays to lists, undefined to None. Note that due implementation limitations the string 'null' will be evaluated to None.
You must escape \n and \r among other escape sequences if they present in Javascript code. Otherwise they get parsed by Python. r'strings' is a recommended way to load Javascript.</p> <h2 id="get-current-url"><a href="#get-current-url" aria-hidden="true" class="header-anchor">#</a> get_current_url</h2> <div class="language-python extra-class"><pre class="language-python"><code>get_current_url<span class="token punctuation">(</span>uid<span class="token operator">=</span><span class="token string">'master'</span><span class="token punctuation">)</span>
</code></pre></div><p>Return the current URL in the specified window. None if no url is loaded.</p> <p><a href="/2.4/examples/get_current_url.html">Example</a></p> <h2 id="load-css"><a href="#load-css" aria-hidden="true" class="header-anchor">#</a> load_css</h2> <div class="language-python extra-class"><pre class="language-python"><code>load_css<span class="token punctuation">(</span>css<span class="token punctuation">,</span> uid<span class="token operator">=</span><span class="token string">'master'</span><span class="token punctuation">)</span>
</code></pre></div><p>Load CSS as string into the specified window.</p> <p><a href="/2.4/examples/css_load.html">Example</a></p> <h2 id="load-html"><a href="#load-html" aria-hidden="true" class="header-anchor">#</a> load_html</h2> <div class="language-python extra-class"><pre class="language-python"><code>load_html<span class="token punctuation">(</span>content<span class="token punctuation">,</span> base_uri<span class="token operator">=</span>base_uri<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> uid<span class="token operator">=</span><span class="token string">'master'</span><span class="token punctuation">)</span>
</code></pre></div><p>Load HTML code into the specified window. Base URL for resolving relative URLs is set to the directory the program is launched from. Note that you cannot use hashbang anchors when HTML is loaded this way.</p> <p><a href="/2.4/examples/html_load.html">Example</a></p> <h2 id="load-url"><a href="#load-url" aria-hidden="true" class="header-anchor">#</a> load_url</h2> <div class="language-python extra-class"><pre class="language-python"><code>load_url<span class="token punctuation">(</span>url<span class="token punctuation">,</span> uid<span class="token operator">=</span><span class="token string">'master'</span><span class="token punctuation">)</span>
</code></pre></div><p>Load a new URL into the specified <em>pywebview</em> window.</p> <p><a href="/2.4/examples/change_url.html">Example</a></p> <h2 id="set-title"><a href="#set-title" aria-hidden="true" class="header-anchor">#</a> set_title</h2> <div class="language-python extra-class"><pre class="language-python"><code>set_title<span class="token punctuation">(</span>title<span class="token punctuation">,</span> uid<span class="token operator">=</span><span class="token string">'master'</span><span class="token punctuation">)</span>
</code></pre></div><p>Change the title of the window</p> <p><a href="/2.4/examples/window_title_change.html">Example</a></p> <h2 id="toggle-fullscreen"><a href="#toggle-fullscreen" aria-hidden="true" class="header-anchor">#</a> toggle_fullscreen</h2> <div class="language-python extra-class"><pre class="language-python"><code>togle_fullscree<span class="token punctuation">(</span>uid<span class="token operator">=</span><span class="token string">'master'</span><span class="token punctuation">)</span>
</code></pre></div><p>Toggle fullscreen mode of a window on the active monitor.</p> <p><a href="/2.4/examples/toggle_fullscreen.html">Example</a></p> <h2 id="window-exists"><a href="#window-exists" aria-hidden="true" class="header-anchor">#</a> window_exists</h2> <div class="language-python extra-class"><pre class="language-python"><code>window_exists<span class="token punctuation">(</span>uid<span class="token operator">=</span><span class="token string">'master'</span><span class="token punctuation">)</span>
</code></pre></div><p>Return True if a <em>pywebview</em> window with the given uid is up and running, False otherwise.</p> <h2 id="config"><a href="#config" aria-hidden="true" class="header-anchor">#</a> config</h2> <div class="language- extra-class"><pre class="language-text"><code>config.gui = 'qt' | 'gtk'
</code></pre></div><p>Force GUI library to either GTK or QT. The same setting can be controlled via <code>PYWEBVIEW_GUI</code> environmental variable</p></div> <div class="page-edit"><div class="edit-link"><a href="https://github.com/r0x0r/pywebview/edit/docs/docs/guide/api.md" target="_blank" rel="noopener noreferrer">Help us improve this page!</a> <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></div> <!----></div> <div class="page-nav"><p class="inner"><span class="prev">
←
<a href="/2.4/guide/usage.html" class="prev">
Usage
</a></span> <span class="next"><a href="/2.4/guide/architecture.html">
Application architecture
</a>
→
</span></p></div> </div> <!----></div></div>
<script src="/2.4/assets/js/app.ab883ad2.js" defer></script><script src="/2.4/assets/js/31.c651468e.js" defer></script>
</body>
</html>
|