On Fri, 29 Apr 2005 05:28:23 -0700 (PDT)
Mahmad Sadique Hannure <[EMAIL PROTECTED]> wrote:

> I am working on a module called Report Bugs which
> requires a hyperlink which open our web site in
> default browser. I am able to implement effect looks
> like a hyperlink by using Pango Markup language
> as like
> 
> 
> label.set_text("<span foreground=\"blue\"
> underline=\"single\">" +[PROTECTED WEB SITE] +
> </span>")
> label.set_use_markup(True)
> 
> So if any one knows the solution please help me

Well, you put the label inside a button. Gnome btw. has a widget (GnomeHRef) 
for this precise purpose.
But since I don't want my app depend on Gnome, I have created my own version, 
which was easy enough.

It starts like that:

def href_button(box, caption):
    hbox = gtk.HBox(False) ; box.pack_start(hbox, True, True, 0)
    label = gtk.Label("<span foreground='blue' 
underline='low'>"+caption+':'+'</span>')
    label.set_use_markup(True)
    button = gtk.Button()
    button.add(label)
    button.set_relief(gtk.RELIEF_NONE)
    ...

How do you plan to get the default browser? If you read the Gnome GConf key, be 
aware that you are excluding all non-Gnome users, which usually won't bother 
with Gnome's Control Center. You *can* use the Gnome preferred apps key, but it 
is a good idea to make the browser choice configurable from inside your app as 
well. The kind of "integration" which the "Preferred Applications" capplet 
provides is misguided and a disservice to FOSS users at large lest it happens 
in a freedesktop.org context.

_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to