Giter Site home page Giter Site logo

webview_python's Introduction

webview

Python extension that provides API for the webview library.

Getting started

Install the bindings:

pip install webview

Try the following example:

import webview

w = webview.WebView(width=320, height=240, title="Hello", url="https://google.com", resizable=True, debug=False)
w.run()

You may use most of the webview APIs:

# Change window title
w.set_title("New title")
# Make window fullscreen
w.set_fullscreen(True)
# Change initial window background color
w.set_color(255, 0, 0)
# Inject some JS
w.eval("alert('hello')")
# Inject some CSS
w.inject_css('* {background-color: yellow; }')
# Show native OS dialog
file_path = w.dialog(0, 0, "open file", "")
# Post funciton to the UI thread
w.dispatch(some_func)
w.dispatch(lambda: some_func())
# Control run loop
while w.loop(True):
  pass

Dispatch is currently only a stub and is implemented as direct function call. Also, proper Python-to-JS object mapping is not implemented yet, but is highly

Development

To build and install the library locally:

python setup.py install

To upload a new version:

python setup.py sdist
twine upload dist/webview-*.tar.gz

To build and install it locally:

python setup.py install

Please, ensure that all sources are formatted using yapf.

webview_python's People

Contributors

zserge avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.