GTK Web Browser UI Issues

gtkmozembed web browser

Page 1 of 1

2 Replies - 3199 Views - Last Post: 22 February 2010 - 06:22 PM Rate Topic: -----

#1 CodyWD  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 21-February 10

GTK Web Browser UI Issues

Posted 21 February 2010 - 09:10 PM

Main Problem: Gtk.Entry box does NOT update to URL change. Can not find any way to make it do so.
Other minor problems:
Window Title does NOT update to page change
Reload does not seem to work (perhaps it does, but is too fast???)

My code:
#!/usr/bin/env python

import os
import sys
try: 
	import pygtk
	pygtk.require("2.0")
except:
	pass
try:
	import gtk
	import gtkmozembed
except:
	sys.exit(1)

class WebBrowser:
	def GoBack(self, widget):
		self.moz.go_back()

	def GoUrl(self, widget):
		text = self.uri.get_text()
		url  = str(text)
		self.moz.load_url(url)

	def GoFwd(self, widget):
		self.moz.go_forward()

	def Reload(self, widget):
		self.moz.reload()

	def Stop(self, widget):
		self.moz.stop_load()

	def __init__(self):
		win    = gtk.Window(gtk.WINDOW_TOPLEVEL)
		self.moz    = gtkmozembed.MozEmbed()
		vbox   = gtk.VBox()
		hbox   = gtk.HBox()
		back   = gtk.Button("Back")
		fwd    = gtk.Button("Forward")
		stop   = gtk.Button("Stop")
		rld    = gtk.Button("Reload")
		self.uri    = gtk.Entry()
		gobtn  = gtk.Button("Go")
		status = gtk.Statusbar()
		prog   = gtk.ProgressBar(adjustment=None)
		doctitle = self.moz.get_title()

		win.add(vbox)	
		vbox.pack_start(hbox, False, False, 0)
		hbox.pack_start(back, False, False, 0)
		hbox.pack_start(fwd, False, False, 0)
		hbox.pack_start(stop, False, False, 0)
		hbox.pack_start(rld, False, False, 0)
		hbox.pack_start(self.uri, True, True, 0)
		hbox.pack_start(gobtn, False, False, 0)
		vbox.pack_start(self.moz, True, True, 0)
		vbox.pack_start(status, False, False, 0)

		self.moz.load_url("http://www.google.com")
		sf = self.moz.get_location()
		self.uri.set_text = sf
		back.connect("clicked", self.GoBack )
		fwd.connect("clicked", self.GoFwd )
		rld.connect("clicked", self.Reload )
		stop.connect("clicked", self.Stop )
		gobtn.connect("clicked", self.GoUrl )
		win.set_title("GWebBrowser")
		win.set_size_request(1000,600)
		win.show_all()
		win.connect("destroy", gtk.main_quit )

if __name__ == "__main__":
	wb = WebBrowser()
	gtk.main()


Help would be appreciated :)

This post has been edited by CodyWD: 21 February 2010 - 10:51 PM


Is This A Good Question/Topic? 0
  • +

Replies To: GTK Web Browser UI Issues

#2 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 828
  • View blog
  • Posts: 2,236
  • Joined: 23-December 08

Re: GTK Web Browser UI Issues

Posted 21 February 2010 - 11:53 PM

Well boss, I gotta tell you, this is one of the more interesting projects I've seen so far! I'm a student myself, so something this big might take me a few days to get back to you on, if I can at all. I'll do my best to play around with it and see what I can find.

In the meantime, what version of python are you using?
Was This Post Helpful? 0
  • +
  • -

#3 CodyWD  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 21-February 10

Re: GTK Web Browser UI Issues

Posted 22 February 2010 - 06:22 PM

View Postatraub, on 21 February 2010 - 10:53 PM, said:

Well boss, I gotta tell you, this is one of the more interesting projects I've seen so far! I'm a student myself, so something this big might take me a few days to get back to you on, if I can at all. I'll do my best to play around with it and see what I can find.

In the meantime, what version of python are you using?


Haha yea, I like making a web browser in each language i learn because I feel accomplished and smart in that language after that (Though I know that even after, I am still quite newbish :P)

I am also using Python 2.6.4
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1