class ScrollingFrame:
def __init__(self, root:Frame):
#outer placeholder frame for canvas and scrollbar
self.sf_outer_frame = Frame(master=root, background='pink');
self.sf_outer_frame.columnconfigure(index=0, weight=1)
self.sf_outer_frame.columnconfigure(index=1, weight=0)
self.sf_outer_frame.rowconfigure(index=0, weight=1)
self.sf_canvas = Canvas(master=self.sf_outer_frame, background='purple');
self.sf_canvas.grid(row=0, column=0, sticky='nsew', padx=10, pady=10)
self.sf_scroller = Scrollbar(master=self.sf_outer_frame, orient='vertical', command=self.sf_canvas.yview);
self.sf_canvas.config(yscrollcommand=self.sf_scroller.set)
self.sf_scroller.grid(row=0, column=1, sticky='ns')
self.sf_inner_frame = Frame(master=self.sf_canvas, background='orange');
self.sf_canvas.create_window((0, 0), window=self.sf_inner_frame, anchor='nw')
self.sf_inner_frame.bind('<Configure>', lambda event:self.sf_canvas.configure(scrollregion=self.sf_canvas.bbox('all')))
def get_handle_frame(self):
return self.sf_outer_frame```
this is how far i've gotten. I can see that the canvas and the scroll bar are being created but for some reason the inner frame isn't showing! help would be appreciated :)
#๐ Help with creating a scrollable frame in Tkinter
4 messages ยท Page 1 of 1 (latest)
@sweet vapor
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Closes after a period of inactivity, or when you send !close.
@sweet vapor
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.