dimanche 29 mars 2020

How to open pywebview inside kivy application?

I want to open the google webpage inside kivy application, without creating a new window. How can i do this? So far, the code creates a new window for the google page, i haven't managed to display it inside the first page... I am using pywebview to open the web page. I have this code:

import plotly.graph_objs as go
import webview
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.widget import Widget

Builder.load_file('example.kv')

class Wv(Widget):
    def create_webview(self):
        webview.create_window('Hello world', 'https://www.google.com/')
        webview.start()

    def print_me(self):
        print("PUSH button")
        self.create_webview()


class ServiceApp(App):
    def build(self):
        print('something')
        return Wv()


if __name__ == '__main__':
    ServiceApp().run()

And example.kv:

<Wv>:
    button:button
    Button:
        id:button
        text:"push me"
        on_release:root.print_me()




Aucun commentaire:

Enregistrer un commentaire