Code: from tkinter import * from webbrowser import *
def opnbk1():
open('https://www.goodreads.com/Harry_Potter_and_the_Sorcerer_s_Stone?ac=1&from_rank=1')
def test():
Bk= Tk()
bk1 = PhotoImage(file='HP.png')
book1 = Button(Bk,image=bk1,command=opnbk1,bg='white').place(relx=0,rely=0)
Bk.mainloop()
test()#This function call works,but inside the window root, it does not.
root=Tk()
b2 = Button(root, text='Click Me', command=test).place(relx=0.167, rely=0.9)
root.mainloop()
Thank you!