How to Embed Web Browser in Python GTK application using pymozembed

Embedding web browser or a screen for parsing HTML is easy in PyGTK. You only need to import the pymozembed, and add a few lines of code in your pygtk library, and you are set to go.

Here’s a sample PyGTK application that embeds a web-browser as well as a “Back” button for demonstration purpose :

PyGTK + browser Screenshot
PyMozEmbed PyGTK+ Mypapit Demo

# demo by mypapit ( – Sept 2009
import pygtk
import gtk
import gtkmozembed

class PyMoz:

def delete_event(self,widget,data=None):
return False

def destroy(self,widget,data=None):

def button_clicked(self,widget,data):

def __init__(self):
#init mozembed
self.moz = gtkmozembed.MozEmbed()
#create a Vertical Box Container to whole the browser
#and the “Back Button”
box = gtk.VBox(False,0)

#create a basic GTK+ window
win = gtk.Window()

#create and connect “Back” button, to add functionality
self.button = gtk.Button(“Back”)

#include both back button and the browser in the vertical box
#and the GTK+ window

#load the URL

#set the window title
win.set_title(“browser demo”)

#show all the stuffs on screen

#connect the delete_event and destroy event to make sure
#the app quits when the window is closed

if __name__ == “__main__”:


Download demo source code :

Google Chrome for Linux and Mac Developer release

Google Chrome for GNU / Linux and Mac has finally arrived! However it is only an early version for developers and lack features that would make it usable in production environment.

Google Chrome Logo

Missing features from early release of Linux & Mac Google Chrome are :

  • Can’t view Youtube videos
  • Missing TIFF support
  • Loads of memory leaks
  • Does not have bookmark manager
  • No Java plugin support
  • No printing
  • Problem with rendering certain websites
  • Occasional crashes and freeze up
  • and many more…

So if you are just an average user, do not download this release just yet! Instead, wait for a few months for a much more (?) BETA release to be available.

The developer channel release was made in order to elicit responses and bug reports from users to prepare for a more stable BETA release.

[Google’s original announcement]

How to change Google Chrome user-agent

Changing user-agent in Mozilla Firefox and Internet Explorer may be an easy task for most of the people as it only requires you to change certain settings in the browser option or in the registry.

However changing Google Chrome’s user agent might not be as straight forward as it has no obvious way to alter it through the browser’s interface.

Fortunately, Digital Inspiration website has written a guide on how to change Google Chrome user-agent string, you can refer directly to their article – How to Change User Agent String in Google Chrome Browser

The Latest buzz: Google Chrome

Looks like I’m the last person to write about Chrome, the latest browser from Google. This is because I do not own a Microsoft Windows machine to test Chrome early on.

I’m sure you can find a lot of great reviews floating around the internet about the latest lightweight browser, so I will not waste your time by rehashing those information here.

Google Chrome
Chrome Application Shortcut

What actually caught my attention is the “Create Application Shortcut” found in Chrome, a functionality similar to Mozilla Prism which I’ve reviewed a while back in my blog. This would enable users to create Desktop shortcuts of their favorite Web Application without relying to external application like Prism anymore, everything can be done neatly within a single interface.

With Chrome, Javascript execution (read: ajax’ed website) felt a lot more faster while using much less memory, it looks like this new browser is going to give Mozilla a run for its money.

p/s: Eagerly waiting for Chrome to be available on GNU/Linux platforms.

Read Googlebooks Chrome Comic for more insight about Google Chrome