How to make an url button in Blender interface

In order to navigate to an URL-address from Blender – to open the required address in the browser, we can use the system operator “wm.url_open”.

To demonstrate this let’s create a simple tab in the N-panel with a single button, by clicking on which the required page will be opened in the browser.

At first, let’s create a class to describe a simple tab in the 3D Viewport window N-panel and register it in the API.

This class creates a panel named “URL” in the N-panel of the viewport window.

To add a button to it that calls the “wm.url_open” operator, let’s describe the call of the required operator in the “draw” function.

and pass a parameter with the required URL-address to it.

Full code:

After executing this code, a new “URL” tab with the “Open URL” button will be created in the N-panel of the viewport. When you press it, the default browser will open the specified URL-address.

5 1 vote
Article Rating
Subscribe
Notify of
guest

0 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments