Skip to content
Advertisement

How can I make a button that goes to website in pygame?

I have a “Credits” menu in my pygame and I’d like to make some buttons that go to certain websites.

What I mean is, when the button is clicked, it should open up, for example, GitHub (or whatever the link is).

Is there a way I can achieve this?

Advertisement

Answer

Implement a Button class ans use the webbrowser module to open an URL

JavaScript
JavaScript

See also Pygame mouse clicking detection and How can I open a website in my web browser using Python?


Minimal example:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement