#๐Ÿ”’ How would i make this wait for me to click the box and run this command

5 messages ยท Page 1 of 1 (latest)

buoyant citrus
#

webbrowser.open("https://music.youtube.com", new=0, autoraise=True)


this is the code so far;


from webbrowser import *
from tkinter import *
from tkinter import ttk
root = Tk()
frm = ttk.Frame(root, padding=10)
frm.grid()
ttk.Label(frm, text="Hello World!").grid(column=0, row=0)
ttk.Button(frm, text="Google", command=root.destroy).grid(column=1, row=0)
ttk.Button(frm, text="Quit", command=root.destroy).grid(column=1, row=2)
root.mainloop()

but i'm trying to get it to open the URL if i click the Tkinter Box

terse leafBOT
#

@buoyant citrus

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

wintry ingot
#
from webbrowser import *
from tkinter import *
from tkinter import ttk
def open_google_music():
    open("https://music.youtube.com/", new=0, autoraise=True)
def quit_app():
    root.destroy()
root = Tk()
frm = ttk.Frame(root, padding=10)
frm.grid()
ttk.Label(frm, text="Hello World!").grid(column=0, row=0)
ttk.Button(frm, text="Google", command=open_google_music).grid(column=1, row=0)
ttk.Button(frm, text="Quit", command=quit_app).grid(column=1, row=2)
root.mainloop()
terse leafBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.