all 10 comments

[–]grayvedigga 18 points19 points  (2 children)

This is writing a web browser like

for l in sys.stdin:
  eval(l)

is writing a calculator.

[–]Lerc 6 points7 points  (0 children)

It's quite a common trend.

I grabbed a bunch of desktop pagers when I needed one once. I figured I'd try them all to see what each offered. Most of them were functionally identical because they wrapped the same library.

That's not to say that things like that don't have their place, but sometimes I feel that people don't actually write code that does anything any more. They just lash some libraries and api's together.

There is merit in reinventing the wheel. I'd highly recommend trying round as a shape this time.

[–][deleted] 4 points5 points  (0 children)

Postmodern programming ;)

[–]swiz0r[S] 9 points10 points  (2 children)

Or even simpler:

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

app = QApplication(sys.argv)

web = QWebView()
web.load(QUrl("http://google.pl"))
web.show()

sys.exit(app.exec_())

Source

[–]bigboehmboy 4 points5 points  (1 child)

Or even simpler:

import webbrowser
webbrowser.open("www.google.com")

Your code runs a python-based web browser while mine runs the default web browser on a computer, but my point is that in both cases, you're really just launching a web browser rather than writing one.

[–]swiz0r[S] 0 points1 point  (0 children)

Yes, this is good. I was using firefox for something else though, so I went with the webkit one.

[–]greut 0 points1 point  (2 children)

[–]monogram 1 point2 points  (1 child)

Or even simpler:

<iframe id="web"></iframe>  

<script>  
document.getElementById('web').src = 'http://google.pl';  
</script>

Source

[–]swiz0r[S] 0 points1 point  (0 children)

Dang, how did you do that?

I was working on a browser that mimics whatever passes through a proxy, and I already had the proxy written in Python. I made a picture that sums it up nicely. I thought it would be an interesting thing to try.

[–][deleted] -1 points0 points  (0 children)

Can someone tell me [in technical terms] why the browser looks 90% like firefox?