Code:
Shell Error(once address is inputed):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
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() |
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.