I’m trying to code an AI for finding the path in a maze. The maze can be made by dragging and dropping a block onto a grid, and for the grid there’s a separate frame. Whenever i try to bind scrollbars to the frame I get this error:
Traceback (most recent call last):
File "C:\Users\DEVDHRITI\Desktop\Files&Folders\HMMMMM\path finder\path finder.pyw", line 62, in <module>
grid = Frame(root, yscrollcommand = yscrollbar.set, xscrollcommand = xscrollbar.set)
File "C:\Users\DEVDHRITI\AppData\Local\Programs\Python\Python310\lib\tkinter\__init__.py", line 3153, in __init__
Widget.__init__(self, master, 'frame', cnf, {}, extra)
File "C:\Users\DEVDHRITI\AppData\Local\Programs\Python\Python310\lib\tkinter\__init__.py", line 2601, in __init__
self.tk.call(
_tkinter.TclError: unknown option "-yscrollcommand"
Here’s my code:
from tkinter import *
from threading import Thread
class Setting:
def __init__(self):
settings = {}
file = open("user-setting.setting", "r")
self.file = file
for pair in file.read().split("\n"):
exec("settings.update({" + pair + "})")
self.settings = settings
def edit(self, setting, new_setting):
self.settings[setting] = new_setting
def reopen(self):
self.file = open("user-setting.setting", "r")
def save(self):
self.file.close()
file = open("user-setting.setting","w")
for x in self.settings:
file.write('"' + x + '"' + ":" + self.settings[x])
settings = Setting()
root = Tk()
root.geometry(settings.settings["geometry"])
def save():
settings.settings["geometry"] = root.geometry()
settings.save()
root.protocol("WM_DELETE_WINDOW", save)
yscrollbar = Scrollbar(root, orient = "vertical")
xscrollbar = Scrollbar(root, orient = "horizontal")
ribbon = Frame(root, height = 40, borderwidth = 5)
grid = Frame(root, yscrollcommand = yscrollbar.set, xscrollcommand = xscrollbar.set)
yscrollbar.pack(fill = "y", side = "right")
xscrollbar.pack(fill = "x", side = "bottom")
ribbon.pack(fill = "x", side = "top")
grid.pack(fill = "both", expand = True)
yscrollbar.config(command = grid.yview)
xscrollbar.config(command = grid.xview)
root.mainloop()
Anyone know why is this happening? I’m using python 3.10,0, if it helps