I have created a PyGTK LinkButton on Windows. It contains a URI that I want to open in the user’s browser.
gtk.LinkButton("http://www.mysite.com")
The documentation here suggests I need to provide a hook function to gtk.link_button_set_uri_hook. Is there a function built in to PyGTK that I can use cross-platform, or do I need to write my own Windows-specific function?
What have you tried? You don’t have to supply an URI hook. Just provide the URI and the
LinkButtonwill take care of the rest. Minimal example:This creates a window with a single button that when clicked opens Google in the systems default web browser.
If for any reason this doesn’t work, you can have a look at the
webbrowsermodule in the Python standard library which provides cross-platform support (I don’t know if this module is used in gtk internally as well, in this case it just wouldn’t make a difference).