[pygtk] Entry level question about gtkmozembed signal emit.

Song Liu alexliu1979 at gmail.com
Mon Sep 8 14:02:58 WST 2008


Hi all,

I wrote my first gtkmozembed hello word program using:
gnome-python2-gtkmozembed.x86_64 2.14.2-6.el5 together with firefox 3.0.1
1.el5.centos version.
But I encountered a problem, I cannot capture the "net-start" or "net-stop"
signal during "load_url".

Could you please help me to point out where should I fix for this simple
hello world program?

Thanks in advance.

Here is my hello world code:

#!/usr/bin/env python

import os

class TinyGecko:
    def __init__(self):
        gtkmozembed.set_comp_path("/usr/lib64/firefox-3.0.1/")
        self.moz = gtkmozembed.MozEmbed()
        win = gtk.Window()
        win.add(self.moz)
        id = self.moz.connect("net-stop", self.on_net_stop)
        print("binding signals net-stop: %s" % id)
        id = self.moz.connect("net-start", self.on_net_start)
        print("binding signals net-start: %s" % id)
        win.show_all()
        self.moz.load_url('http://www.pygtk.org')
        print("page loaded")

    def on_net_start(self):
        print("got on_net_start")

    def on_net_stop(self):
        print("got on_net_start")

if __name__ == '__main__':
  # Set the display correctly BEFORE including gtk.
  os.environ["DISPLAY"] = ":2.0"

  import pygtk
  import gtk
  import gobject
  import gtk.gdk
  import gtkmozembed

  TinyGecko()
  gtk.gdk.threads_enter()
  gtk.main()
  gtk.gdk.threads_leave()

Best Regards,
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20080908/be7cee70/attachment.htm 


More information about the pygtk mailing list