Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build a simple browser with python [closed]

I want to build an ultra minimal browser which will just load one url, and will always be in full screen or kiosk mode. I will be running this in a Raspberry Pi. I explored several options in stack overflow and Google. Below are the potential solutions I found, but just can't decide the best and easiest method out of it.

  1. Python + Gtk
  2. QT
  3. NodeWebkit (I couldn't get it installed)

One advantage if we use python is that in raspberry pi, I have Raspbian running which comes with python.

I would really appreciate an opinion from experienced developers.

like image 360
esafwan Avatar asked Dec 10 '25 05:12

esafwan


1 Answers

I cannot really evaluate whether this is the easiest option but this is how you would do it with python and gtk:

from gi.repository import Gtk
from gi.repository import WebKit2

class  BrowserView:
    def __init__(self):
        window = Gtk.Window()
        window.connect('delete-event',Gtk.main_quit)

        self.view = WebKit2.WebView()
        self.view.load_uri('http://example.net')

        window.add(self.view)
        window.fullscreen()
        window.show_all()


if __name__ == "__main__":
    BrowserView()
    Gtk.main()
like image 65
elya5 Avatar answered Dec 11 '25 18:12

elya5



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!