0

So I have been coding a search bar type thing in Python because I was bored and all. And when searching something with it, it opens in Internet Explorer instead of my default browser (Chrome).

from tkinter import *
import webbrowser

win = Tk()
win.title("Search Bar")

def search():
    url = entry.get()
    webbrowser.open(url)

label1 = Label(win,text="Enter URL Here :        "
               ,font=("arial",10,"bold"))
label1.grid(row=0,column=0)

entry = Entry(win,width=30)
entry.grid(row=0,column=1)

button = Button(win,text="Search",command=search)
button.grid(row=1,column=0,columnspan=2,pady=10)
win.mainloop()
etch_45
  • 792
  • 1
  • 6
  • 21
Mr.Scatman7
  • 5
  • 1
  • 2
  • 1
    Does this answer your question? [Python webbrowser.open() to open Chrome browser](https://stackoverflow.com/questions/22445217/python-webbrowser-open-to-open-chrome-browser) – Tomerikoo Dec 15 '20 at 12:28
  • Does this answer your question? [python's webbrowser launches IE instead of default on windows 7](https://stackoverflow.com/questions/5916270/pythons-webbrowser-launches-ie-instead-of-default-on-windows-7) – etch_45 Dec 15 '20 at 12:36
  • I think this is because it is the default browser, for me it opens on my default browser – Delrius Euphoria Dec 15 '20 at 12:54

1 Answers1

0

try like this

webbrowser.get('chrome').open('https://stackoverflow.com/')

OR

webbrowser.get("C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s").open("http://google.com")
Ehtisham Ahmed
  • 387
  • 3
  • 15