Opening a URL from Tkinter

Asked

Viewed 474 times

-1

It is possible link a website using Python code? For example, in a menu made in Tkinter (object orientation) I wanted to click button and be redirected to a site.

1 answer

4

Python has the package webbrowser natively. In this module there is defined function open which can be used to open a URL through the user’s default browser.

Since you didn’t show us any code, I leave a simple example of what it would be like to open the URL by pressing a button:

button = Button(frame, text="Abrir URL", command=lambda: webbrowser.open('SUA URL AQUI'))

Browser other questions tagged

You are not signed in. Login or sign up in order to post.