class App(CTk):
def __init__(self):
super().__init__()
self.button = CTkButton(
self, text="Blogs", #Text to be displayed
fg_color="#ec3642", #color of the button
hover_color="white", #color of the button when mouse is over
font=("Montserrat", 16), #font used
corner_radius=12, width=100, #radius of edges and total width
command=self.open) #Command to run when button is clicked
self.button.pack(padx = 10, pady = 10)
def open(self):
import webbrowser #library to open a specific URL
# Opening the given link.
webbrowser.open("https://python-hub.com/blog-2/")
if __name__ == "__main__":
app = App()
app.mainloop()
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter