I
I
i3stone2022-02-28 10:16:34
Python
i3stone, 2022-02-28 10:16:34

How to return to the previous page in pywebview and vice versa?

I need to make a simple browser in Python kivy, this is what I have:

code in 20 lines

from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
import threading
import webview
class LoginScreen(BoxLayout):    
    def __init__(self, **kwargs):
        super(LoginScreen, self).__init__(**kwargs)
        self.btn1 = self.add_widget(Button(text='Web',on_press=self.on_web)) 
    def on_web(self,instance):
        url='http://www.google.com'
        print("Im open windows")
        webview.create_window('My Web App', url=url)
        webview.start(debug=True)

class MyApp(App):    
    def build(self):
        return LoginScreen()
if __name__ == '__main__':
    MyApp().run()


But the problem is that if you go to any site, then you can no longer go back, what methods are there in pywebview so that you can go back when you click on the button?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question