Python‎ > ‎webbrowser‎ > ‎

webbrowser.open_new_tab()

http://www.adilwaseem.com/

Definition
Open the request into new tab.

Syntax
webbrowser.open_new_tab()

Parameters
string

Examples
The syntax open the input() into new default browser.
import webbrowser

x=input("Please enter your web address: ")

y=len(x)
z=float(y)

if z > 7:
    webbrowser.open_new_tab(x)
else:
    
>>> 
Please enter your web address: cnn.com
>>>

The URL is opened through tkinter.Button() through its command option.
import webbrowser
from tkinter import*

def url():
    url=webbrowser.open_new("www.pythonlake.com")

master=Tk()
master.geometry("100x200")

button=Button(master, text="pythonlake.com", command=url)
button.pack()

master.mainloop()




Comments