I am building a gui to display rows from my database which spans far enough in both directions that I need scrollbars on x and y axis. I’m not sure if I should provide more code. I won’t provide the whole thing since it’s around 600 lines, but here is the frame that I am trying to add the scrollbars to. Everything else works if I remove the scrollbars so this is currently the only problem. Here is the frame I need help with:
#Code start
main_frame = ctk.CTkFrame(mainWindow)
vsb = ctk.CTkScrollbar(main_frame, orient=”vertical”, command=main_frame.yview)
hsb = ctk.CTkScrollbar(main_frame, orient=”horizontal”, command=main_frame.xview)
main_frame.configure(yscrollcommand=vsb.set, xscrollcommand=hsb.set)
vsb.grid(row=0, column=1, sticky=”ns”)
hsb.grid(row=1, column=0, sticky=”ew”)
main_frame.grid(row=0, column=1, padx=10, pady=5, rowspan=4, sticky=”nsew”)
#Code end
this frame is also gridded inside of the main window with several other frames.
The error I’m getting is:
AttributeError: ‘CTkFrame’ object has no attribute ‘yview’
I have searched some other articles but I didn’t find anything that worked. Right now I setup a simple system of having multiple pages but that isn’t going to work in the long run due to the amount of data and manually having to add a frame for each page so I would prefer to make the scrollbars work. I do have another frame that populates inside this frame to display the data and when I added scrollbars to that it didn’t seem to work since that data is gridded and the scrollbar populated but didn’t seem to detect the data out of view to allow for scrolling. I have also tried to use a Scrollable frame and then add a scrollbar on different parent frames and that didn’t work either.
Alexander Lovelady is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.