Code:
import tkinter as tk from urllib.request import urlopen root=tk.Tk() pagestuff=[] pagestuff.append(tk.Label(root, text="This is a test.")) for i in pagestuff: i.pack(anchor=tk.NW) def goto(): global pagestuff for i in pagestuff: i.pack_forget() i.destroy() del i for i in str(urlopen(address.get()).read()).split("\n"): if i.startswith("h1>"): pagestuff.append(tk.Label(root, text=i[2:], font="Helvetica 15")) elif i.startswith("p>"): pagestuff.append(tk.Label(root, text=i[1:])) for i in pagestuff: i.pack() address=tk.Entry(root) goto=tk.Button(root, text="Go To", command=goto) address.pack() goto.pack() tk.mainloop()Shell Error(once address is inputed):
Error:Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\mjmin\AppData\Local\Programs\Python\Python38-32\lib\tkinter\__init__.py", line 1883, in __call__
return self.func(*args)
File "D:\browse\actualthing.py", line 25, in goto
i.pack()
File "C:\Users\mjmin\AppData\Local\Programs\Python\Python38-32\lib\tkinter\__init__.py", line 2387, in pack_configure
self.tk.call(
_tkinter.TclError: bad window path name ".!label"
For context, I'm making my own little website format and browser/engine for said format.