File: loading_animation.html

package info (click to toggle)
python-pywebview 5.0.5%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 33,680 kB
  • sloc: python: 9,592; javascript: 917; java: 158; cs: 130; sh: 16; makefile: 3
file content (170 lines) | stat: -rw-r--r-- 16,200 bytes parent folder | download
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Loading animation | pywebview</title>
    <meta name="generator" content="VuePress 1.9.7">

    <meta name="description" content="Build GUI for your Python program with JavaScript, HTML, and CSS">

    <link rel="preload" href="/3.7/assets/css/0.styles.28a501df.css" as="style"><link rel="preload" href="/3.7/assets/js/app.10a559eb.js" as="script"><link rel="preload" href="/3.7/assets/js/2.0ff7ef1d.js" as="script"><link rel="preload" href="/3.7/assets/js/37.bbba2d58.js" as="script"><link rel="prefetch" href="/3.7/assets/js/10.f125ec08.js"><link rel="prefetch" href="/3.7/assets/js/11.81fead78.js"><link rel="prefetch" href="/3.7/assets/js/12.0a86c191.js"><link rel="prefetch" href="/3.7/assets/js/13.c09145fc.js"><link rel="prefetch" href="/3.7/assets/js/14.2a7dc35b.js"><link rel="prefetch" href="/3.7/assets/js/15.90c9f36a.js"><link rel="prefetch" href="/3.7/assets/js/16.69b1f4b4.js"><link rel="prefetch" href="/3.7/assets/js/17.956ed884.js"><link rel="prefetch" href="/3.7/assets/js/18.bd6678a0.js"><link rel="prefetch" href="/3.7/assets/js/19.b31e62b7.js"><link rel="prefetch" href="/3.7/assets/js/20.cebc4a71.js"><link rel="prefetch" href="/3.7/assets/js/21.d2041966.js"><link rel="prefetch" href="/3.7/assets/js/22.2a3916f2.js"><link rel="prefetch" href="/3.7/assets/js/23.712fbf84.js"><link rel="prefetch" href="/3.7/assets/js/24.f768e66b.js"><link rel="prefetch" href="/3.7/assets/js/25.69b3e415.js"><link rel="prefetch" href="/3.7/assets/js/26.6619f84a.js"><link rel="prefetch" href="/3.7/assets/js/27.e2a4e1bf.js"><link rel="prefetch" href="/3.7/assets/js/28.abcc819c.js"><link rel="prefetch" href="/3.7/assets/js/29.c379d080.js"><link rel="prefetch" href="/3.7/assets/js/3.749f6582.js"><link rel="prefetch" href="/3.7/assets/js/30.771e8640.js"><link rel="prefetch" href="/3.7/assets/js/31.547a8393.js"><link rel="prefetch" href="/3.7/assets/js/32.778a82c7.js"><link rel="prefetch" href="/3.7/assets/js/33.6ff70f11.js"><link rel="prefetch" href="/3.7/assets/js/34.ae1b5fb4.js"><link rel="prefetch" href="/3.7/assets/js/35.c5555b94.js"><link rel="prefetch" href="/3.7/assets/js/36.d53c471f.js"><link rel="prefetch" href="/3.7/assets/js/38.5eb30036.js"><link rel="prefetch" href="/3.7/assets/js/39.8cac65fe.js"><link rel="prefetch" href="/3.7/assets/js/4.f2c64e71.js"><link rel="prefetch" href="/3.7/assets/js/40.53182a9c.js"><link rel="prefetch" href="/3.7/assets/js/41.19399765.js"><link rel="prefetch" href="/3.7/assets/js/42.41128068.js"><link rel="prefetch" href="/3.7/assets/js/43.660f3959.js"><link rel="prefetch" href="/3.7/assets/js/44.09d5c6f8.js"><link rel="prefetch" href="/3.7/assets/js/45.4a818eab.js"><link rel="prefetch" href="/3.7/assets/js/46.d1621897.js"><link rel="prefetch" href="/3.7/assets/js/47.7f8f8dec.js"><link rel="prefetch" href="/3.7/assets/js/48.f27d4c39.js"><link rel="prefetch" href="/3.7/assets/js/49.4189d401.js"><link rel="prefetch" href="/3.7/assets/js/5.2a771d7d.js"><link rel="prefetch" href="/3.7/assets/js/50.beff8380.js"><link rel="prefetch" href="/3.7/assets/js/51.8a918a6c.js"><link rel="prefetch" href="/3.7/assets/js/52.92d0105f.js"><link rel="prefetch" href="/3.7/assets/js/53.28701cde.js"><link rel="prefetch" href="/3.7/assets/js/54.2b15d6fb.js"><link rel="prefetch" href="/3.7/assets/js/55.d231c742.js"><link rel="prefetch" href="/3.7/assets/js/56.7e02bbff.js"><link rel="prefetch" href="/3.7/assets/js/57.61e9e46c.js"><link rel="prefetch" href="/3.7/assets/js/58.cc70e253.js"><link rel="prefetch" href="/3.7/assets/js/59.d3f412e7.js"><link rel="prefetch" href="/3.7/assets/js/6.64e1f3ed.js"><link rel="prefetch" href="/3.7/assets/js/60.f4fd7728.js"><link rel="prefetch" href="/3.7/assets/js/61.cd0f1d68.js"><link rel="prefetch" href="/3.7/assets/js/62.bf000bcc.js"><link rel="prefetch" href="/3.7/assets/js/63.807edde1.js"><link rel="prefetch" href="/3.7/assets/js/64.2b6fe843.js"><link rel="prefetch" href="/3.7/assets/js/7.779cbcff.js"><link rel="prefetch" href="/3.7/assets/js/8.66fb3acb.js"><link rel="prefetch" href="/3.7/assets/js/9.84350af9.js">
    <link rel="stylesheet" href="/3.7/assets/css/0.styles.28a501df.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="/3.7/" class="home-link router-link-active"><img src="/3.7/logo-no-text.png" alt="pywebview" class="logo"> <span class="site-name can-hide">pywebview</span></a> <div class="links"><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="/3.7/guide/" class="nav-link">
  Guide
</a></div><div class="nav-item"><a href="/3.7/examples/" class="nav-link router-link-active">
  Examples
</a></div><div class="nav-item"><a href="/3.7/contributing/" class="nav-link">
  Contributing
</a></div><div class="nav-item"><a href="/3.7/blog/" class="nav-link">
  Blog
</a></div><div class="nav-item"><a href="/3.7/CHANGELOG.html" class="nav-link">
  Changelog
</a></div> <a href="https://github.com/r0x0r/pywebview" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" 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> <span class="sr-only">(opens new window)</span></span></a></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/3.7/guide/" class="nav-link">
  Guide
</a></div><div class="nav-item"><a href="/3.7/examples/" class="nav-link router-link-active">
  Examples
</a></div><div class="nav-item"><a href="/3.7/contributing/" class="nav-link">
  Contributing
</a></div><div class="nav-item"><a href="/3.7/blog/" class="nav-link">
  Blog
</a></div><div class="nav-item"><a href="/3.7/CHANGELOG.html" class="nav-link">
  Changelog
</a></div> <a href="https://github.com/r0x0r/pywebview" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" 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> <span class="sr-only">(opens new window)</span></span></a></nav>  <ul class="sidebar-links"><li><a href="/3.7/examples/cef.html" class="sidebar-link">CEF support</a></li><li><a href="/3.7/examples/change_url.html" class="sidebar-link">Change URL</a></li><li><a href="/3.7/examples/css_load.html" class="sidebar-link">CSS load</a></li><li><a href="/3.7/examples/close_confirm.html" class="sidebar-link">Quit confirmation dialog</a></li><li><a href="/3.7/examples/debug.html" class="sidebar-link">Debugging</a></li><li><a href="/3.7/examples/destroy_window.html" class="sidebar-link">Destroy window</a></li><li><a href="/3.7/examples/events.html" class="sidebar-link">Events</a></li><li><a href="/3.7/examples/frameless.html" class="sidebar-link">Frameless window</a></li><li><a href="/3.7/examples/fullscreen.html" class="sidebar-link">Fullscreen window</a></li><li><a href="/3.7/examples/get_elements.html" class="sidebar-link">Get DOM elements</a></li><li><a href="/3.7/examples/get_current_url.html" class="sidebar-link">Get current URL</a></li><li><a href="/3.7/examples/hide_window.html" class="sidebar-link">Hide / show window</a></li><li><a href="/3.7/examples/html_load.html" class="sidebar-link">HTML load</a></li><li><a href="/3.7/examples/js_evaluate.html" class="sidebar-link">Javascript evaluation</a></li><li><a href="/3.7/examples/js_api.html" class="sidebar-link">Javascript API</a></li><li><a href="/3.7/examples/loading_animation.html" aria-current="page" class="active sidebar-link">Loading animation</a></li><li><a href="/3.7/examples/links.html" class="sidebar-link">Link types</a></li><li><a href="/3.7/examples/localization.html" class="sidebar-link">Localization</a></li><li><a href="/3.7/examples/min_size.html" class="sidebar-link">Minimum window size</a></li><li><a href="/3.7/examples/minimize_window.html" class="sidebar-link">Minimize / restore window</a></li><li><a href="/3.7/examples/move_window.html" class="sidebar-link">Move window</a></li><li><a href="/3.7/examples/multiple_windows.html" class="sidebar-link">Multi-window</a></li><li><a href="/3.7/examples/open_file_dialog.html" class="sidebar-link">Open file dialog</a></li><li><a href="/3.7/examples/open_url.html" class="sidebar-link">Open URL</a></li><li><a href="/3.7/examples/resize_window.html" class="sidebar-link">Resize window</a></li><li><a href="/3.7/examples/save_file_dialog.html" class="sidebar-link">Save file dialog</a></li><li><a href="/3.7/examples/screens.html" class="sidebar-link">Screens</a></li><li><a href="/3.7/examples/toggle_fullscreen.html" class="sidebar-link">Toggle full-screen</a></li><li><a href="/3.7/examples/user_agent.html" class="sidebar-link">Change user agent string</a></li><li><a href="/3.7/examples/window_title_change.html" class="sidebar-link">Window title change</a></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="loading-animation"><a href="#loading-animation" class="header-anchor">#</a> Loading animation</h1> <p>Create a loading animation that is displayed before application is loaded.</p> <div class="language-python extra-class"><pre class="language-python"><code><span class="token keyword">import</span> webview


html <span class="token operator">=</span> <span class="token triple-quoted-string string">&quot;&quot;&quot;
    &lt;style&gt;
        body {
            background-color: #333;
            color: white;
            font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
        }

        .main-container {
            width: 100%;
            height: 90vh;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            -webkit-align-items: center;
            justify-content: center;
            -webkit-justify-content: center;
            overflow: hidden;
        }

        .loading-container {
        }

        .loader {
          font-size: 10px;
          margin: 50px auto;
          text-indent: -9999em;
          width: 3rem;
          height: 3rem;
          border-radius: 50%;
          background: #ffffff;
          background: -moz-linear-gradient(left, #ffffff 10%, rgba(255, 255, 255, 0) 42%);
          background: -webkit-linear-gradient(left, #ffffff 10%, rgba(255, 255, 255, 0) 42%);
          background: -o-linear-gradient(left, #ffffff 10%, rgba(255, 255, 255, 0) 42%);
          background: -ms-linear-gradient(left, #ffffff 10%, rgba(255, 255, 255, 0) 42%);
          background: linear-gradient(to right, #ffffff 10%, rgba(255, 255, 255, 0) 42%);
          position: relative;
          -webkit-animation: load3 1.4s infinite linear;
          animation: load3 1.4s infinite linear;
          -webkit-transform: translateZ(0);
          -ms-transform: translateZ(0);
          transform: translateZ(0);
        }
        .loader:before {
          width: 50%;
          height: 50%;
          background: #ffffff;
          border-radius: 100% 0 0 0;
          position: absolute;
          top: 0;
          left: 0;
          content: '';
        }
        .loader:after {
          background: #333;
          width: 75%;
          height: 75%;
          border-radius: 50%;
          content: '';
          margin: auto;
          position: absolute;
          top: 0;
          left: 0;
          bottom: 0;
          right: 0;
        }
        @-webkit-keyframes load3 {
          0% {
            -webkit-transform: rotate(0deg);
            transform: rotate(0deg);
          }
          100% {
            -webkit-transform: rotate(360deg);
            transform: rotate(360deg);
          }
        }
        @keyframes load3 {
          0% {
            -webkit-transform: rotate(0deg);
            transform: rotate(0deg);
          }
          100% {
            -webkit-transform: rotate(360deg);
            transform: rotate(360deg);
          }
        }

        .loaded-container {
            display: none;
        }


    &lt;/style&gt;
    &lt;body&gt;
      &lt;div class=&quot;main-container&quot;&gt;
          &lt;div id=&quot;loader&quot; class=&quot;loading-container&quot;&gt;
              &lt;div class=&quot;loader&quot;&gt;Loading...&lt;/div&gt;
          &lt;/div&gt;

          &lt;div id=&quot;main&quot; class=&quot;loaded-container&quot;&gt;
              &lt;h1&gt;Content is loaded!&lt;/h1&gt;
          &lt;/div&gt;
      &lt;/div&gt;

      &lt;script&gt;
          setTimeout(function() {
              document.getElementById('loader').style.display = 'none'
              document.getElementById('main').style.display = 'block'
          }, 5000)
      &lt;/script&gt;
    &lt;/body&gt;
&quot;&quot;&quot;</span>


<span class="token keyword">if</span> __name__ <span class="token operator">==</span> <span class="token string">'__main__'</span><span class="token punctuation">:</span>
    window <span class="token operator">=</span> webview<span class="token punctuation">.</span>create_window<span class="token punctuation">(</span><span class="token string">'Loading Animation'</span><span class="token punctuation">,</span> html<span class="token operator">=</span>html<span class="token punctuation">,</span> background_color<span class="token operator">=</span><span class="token string">'#333333'</span><span class="token punctuation">)</span>
    webview<span class="token punctuation">.</span>start<span class="token punctuation">(</span><span class="token punctuation">)</span>
</code></pre></div></div> <footer class="page-edit"><div class="edit-link"><a href="https://github.com/r0x0r/pywebview/edit/docs/docs/examples/loading_animation.md" target="_blank" rel="noopener noreferrer">Help us improve this page!</a> <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" 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> <span class="sr-only">(opens new window)</span></span></div> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev">
      <a href="/3.7/examples/js_api.html" class="prev">
        Javascript API
      </a></span> <span class="next"><a href="/3.7/examples/links.html">
        Link types
      </a>
    </span></p></div> </main></div><div class="global-ui"></div></div>
    <script src="/3.7/assets/js/app.10a559eb.js" defer></script><script src="/3.7/assets/js/2.0ff7ef1d.js" defer></script><script src="/3.7/assets/js/37.bbba2d58.js" defer></script>
  </body>
</html>