Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9232755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:23:21+00:00 2026-06-18T06:23:21+00:00

# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- ### BEGIN LICENSE

  • 0
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2012 Marios Papachristou mrmarios97@gmail.com
# This program is free software: you can redistribute it and/or modify it 
# under the terms of the GNU General Public License version 3, as published 
# by the Free Software Foundation.
# 
# This program is distributed in the hope that it will be useful, but 
# WITHOUT ANY WARRANTY; without even the implied warranties of 
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 
# PURPOSE.  See the GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License along 
# with this program.  If not, see <http://www.gnu.org/licenses/>.
### END LICENSE


import gettext
from gettext import gettext as _
gettext.textdomain('quickbrowser')

from gi.repository import Gtk, WebKit # pylint: disable=E0611
import logging
logger = logging.getLogger('quickbrowser')

from quickbrowser_lib import Window
from quickbrowser.AboutQuickbrowserDialog import AboutQuickbrowserDialog
from quickbrowser.PreferencesQuickbrowserDialog import PreferencesQuickbrowserDialog


# See quickbrowser_lib.Window.py for more details about how this class works
class QuickbrowserWindow(Window):
    __gtype_name__ = "QuickbrowserWindow"

    def finish_initializing(self, builder): # pylint: disable=E1002
        """Set up the main window"""
        super(QuickbrowserWindow, self).finish_initializing(builder)

        self.AboutDialog = AboutQuickbrowserDialog
        self.PreferencesDialog = PreferencesQuickbrowserDialog
        self.goBack = self.builder.get_object('goBack')
        self.homeButton = self.builder.get_object('homeButton')
        self.refreshButton = self.builder.get_object('refreshButton')
        self.goButton = self.builder.get_object('goButton')
        self.currentaddresslabel = self.builder.get_object('currentaddresslabel')
        self.addressbar = self.builder.get_object('addressbar')
        self.viewwindow = self.builder.get_object('viewwindow')
        self.goForward = self.builder.get_object('goForward')
        self.zoomIn = self.builder.get_object('zoomIn')
        self.zoomOut = self.builder.get_object('zoomOut')
        self.webview = WebKit.WebView()
        self.viewwindow.add(self.webview)
        self.webview.show()




    def on_addressbar_activate(self, widget):
        address = widget.get_text()
        self.webview.open(address)


    def on_refreshButton_clicked(self, widget):
        self.webview.reload()

    def on_goBack_clicked(self,widget):
        self.webview.go_back();

    def on_goForward_clicked(self,widget):
        self.webview.go_forward();

    def on_zoomIn_activate(self,widget):
        self.webview.zoom_in();

    def on_zoomOut_activate(self,widget):
        self.webview.zoom_out();

    def on_goButton_clicked(self,widget):
        self.webview.open(self.addressbar.get_text())

I am currently developing a web browser in Python using python-webkit.

The source code above is written in order to manage the main window.

How can I constantly display current URL using webview.get_uri() method return value inside a label?

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T06:23:22+00:00Added an answer on June 18, 2026 at 6:23 am
    while True:
        updateLocationBar() # ;)
    

    Surely the location bar already provides this? You could call your label modifying function wherever self.webview.open() is called by writing a wrapper like

    def self.webview.mysuperawesomeopen(uri):
        updateLocationBar()
        self.webview.open(uri)
    

    and then modifying the calls appropriately. Or if you don’t want to change the calls, just move the existing .open() function like

    self.webview.openit = self.window.open
    def self.window.open(uri):
        updateLocationBar()
        self.webview.openit(uri)
    

    Edit: You could also use a function decorator on self.window.open() like

    def labelled(f):
        def labelgo(*args, **kwargs):
            updateLocationBar(*args, **kwargs)
            self.webview.open(*args, **kwargs)
        return labelgo
    
    @labelled # You add this and leave the rest of self.window.open alone
    def self.window.open(uri):
        ...
    

    This would be a better solution if you want to generalise (and you would make the labelled decorator more general – I left this simple as an example).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All, I've recently started doing some javascript coding. I have used the python-mode vim
Normally when you hit tab on an empty line in emacs python mode it
I can't get python-mode working in Emacs on Mac OS X (I am a
How to customize emacs in python-mode to highlight corresponding bracket for a half-second when
Background: I'm using the (fantastic) Vim plugin python-mode , which includes the pep8 linter.
I use python debugger pdb. I use emacs for python programming. I use python-mode.el.
Python language has a well known feature named interactive mode where the interpreter can
In my editor (notepad++) in Python script edit mode, a line ## is this
I have a python .pyd that is a mixed mode C++ DLL. The DLL
I use the Python-mode (not the default one comes with emacs 23). I could

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.