World’s smallest IPv6 compatible web browser program

For a long time now I’ve become a fan of the python+Qt combination. It is great to have an easy to learn, easy to use language with great portability and minimalistic syntax.

The following program has become my favorite showcase for python. To my knowledge, it is the smallest, easier to understand, portable, IPv6 compatible web browser in the world.

If you have IPv6 connectivity just lunch python and copy-paste it save it to a file and run it (it may crash python otherwise):

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *

app=QApplication([])
win=QMainWindow()
w=QWebView(win)
win.setCentralWidget(w)
w.setUrl(QUrl("http://ipv6.google.com/"))
win.show()
app.exec_()

If you don’t then you can try the IPv4 version:

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *

app=QApplication([])
win=QMainWindow()
w=QWebView(win)
win.setCentralWidget(w)
w.setUrl(QUrl("http://www.google.com/"))
win.show()
app.exec_()

In order to be able to run it you’ll need the Qt4 library and the python Qt bindings. If you’re under debian just run:

# apt-get install python-qt4

This should work at least under Linux, Windows, Maemo and perhaps Symbian.

3 Comments

  1. Στέφανε ευχαριστώ για το παράδειγμα, είναι πραγματικά πολύ ενδιαφέρον. Γνωρίζεις εαν υπάρχει κάποιο application για να κάνεις develop το gui, κάτι σαν το glade, για qt?

    Ψάχνω για κάτι απλά για να σχεδιάζω και όχι ένα ολοκληρο qt development ide

Leave a Reply

Your email address will not be published. Required fields are marked *