I am trying to make an interactive graph that is displayed in the Tkinter window. However, I am not able to create a Frame object to place in the Grid of the Tkinter window.
I have created my Tkinter object in a class style here is the instantiation of it
window = Tk()
w = Graph(window, size, startX, startY, endX, endY)
window.geometry('1000x1000')
window.title('Tkinter Testing')
window.mainloop()
I am referring to this tutorial: Tkinter Geometry Manager
for x in range(len(self.graph)):
for y in range(len(self.graph[0])):
frame = window.Frame(
master=window,
relief=window.RAISED,
borderwidth=1
)
frame.grid(row=x,column=y)
label = window.Label(master = frame, text="testing")
This is the error thrown in the console
DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. Please don't rely on it. Set TK_SILENCE_DEPRECATION=1 to suppress this warning.
Traceback (most recent call last):
File "Graph.py", line 158, in <module>
w = Graph(window, size, startX, startY, endX, endY)
File "Graph.py", line 23, in __init__
self.displayGraph()
File "Graph.py", line 39, in displayGraph
frame = window.Frame(
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1909, in __getattr__
return getattr(self.tk, attr)
AttributeError: Frame
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…