[CentralOH] Python Web Browser

William McVey wam at cisco.com
Mon Jul 11 17:14:25 CEST 2011


On Sun, 2011-07-10 at 20:53 -0700, Sean McNally wrote:
> Dear Central Ohio Users,

>     Would Python be a good code choice for creating a web browser? If
> not, which code would you recommend. 

This really depends on what your goal is. There are some really good
python bindings to the main HTML rendering engines now days
(PythonWebKit and PyWebkitGTK/PyWebkitQt4 come to mind). KDE and GTK
also support python interfaces into the default webbrowser control for
each of those interfaces. Even the Windows web control can be
instantiated and controlled from python via the PyWin32 package. This
would allow you to focus your efforts on things like bookmark
management, networking, and UI interface design; rather than HTML
rendering. You'd then have to figure how to handle Javascript (for this,
pyv8 might be able to be employed, although I don't know how/if the v8
engine would have access to the DOM model of the HTML controls I listed
above). Other features of modern browsers (e.g. Flash, SVG, Canvas, etc)
would all require additional libraries or just graceful failure within
your browser. So... to answer your question... there is nothing about
the python language itself that makes it a particularly bad choice, but
the availability of mature libraries that can be used effectively to
make a cohesive whole app (especially wrt things like Javascript and
Flash plugins) means you'd be facing an uphill battle. Of course, that's
if your goal is to make full fledged browser app. If you just want to
suck down some HTML and render it mostly correct in a window... well,
that is pretty simple to do and python is a fine glue language for that
kind of processing.

 -- William



More information about the CentralOH mailing list