Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I tried a bunch of different codes but am still not able to add a back button or add a google search bar.

share|improve this question
Please provide the information and link of the tutorial you are following in order to get the proper support. Thank you. – Geppettvs D'Constanzo Oct 14 '12 at 16:55
Language? Link to tutorial? Previous effort? Also, this probably belongs on Stack Overflow. – Ryan O'Hara Oct 14 '12 at 17:27
IMHO, what every new developer needs to learn first is to correctly program. Learn to use your tools. if you are using Quiclkly, then learn to use Glade and the Python Gtk bindings. If you want to use text input and know what can it mean, then learn string manipulation and regular expressions. ;) – Ángel Araya Oct 14 '12 at 18:16
Every opinion is useful at all but it will be useful if we can have a link on the tutorial that he's attempting so we can focus on providing answers, not HO's. – Geppettvs D'Constanzo Oct 14 '12 at 18:18
up vote 2 down vote accepted

If this is the tutorial by Jono Bacon on Youtube, launch glade with quickly design and add a button to the toolbar similar to the refresh button that Jono adds ~12:30. Call it backbutton and create a handler for it when clicked and then sketch a function that will pull the previous URL that was passed (just create a list and append successful URLs to it, then pop it when needed). If you want to preprocess a URL entered in the entrybox, add code in the handler to do it. Here's some sample code:

#Code for other initializing.... 
....whatever goes here...

def on_urlentry_activate(self,widget):
    #store previous location in history

    url = widget.get_text()

    #add http:// if not present in the url
    if 'http://' not in url:

def on_backbutton_activate(self,widget):
    #Only get the last url if there's something to get
    if len(self.history)!=0:
        #Use pop to remove the last entry from the list

This code is not very sophisticated, but should give you the idea.

As Timo has pointed out, WebKitGTK has a number of great functions and features including a go_back() method (If you read the manual). Here's a callback function which uses it:

def on_backbutton_activate(self, widget):
    if self.webview.can_go_back():
share|improve this answer
Why would you do that if WebKitGTK has such extended API? Just use the go_back() method:… – Timo Oct 14 '12 at 22:29
Honestly, it's because I didn't RTFM and have never used webkitgtk before. This was simply something that popped in my head and I thought would be instructive to someone learning. But your point is taken and I will add it to the answer. – Ian B. Oct 15 '12 at 12:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.