CustomTkinter icon indicating copy to clipboard operation
CustomTkinter copied to clipboard

Difficulties getting Scrolledframe to allow contents to resize

Open Cromwell1963 opened this issue 2 years ago • 4 comments
trafficstars

I have created a ScrolledFrame, in an existing frame, as follows:

        self.scrolling_frame = ScrolledFrame(self.data_frame, padding=0)
        self.scrolling_frame.grid(row=3, column=0, padx=10, pady=10, sticky="nswe")

The ScrolledFrame mostly resizes and works perfectly, however, i cannot get the contents to use the fullwidth of the frame. It's almost as though there is an additional column inside the ScrolledFrame.

I am configuring the ScrolledFrame as follows:

        self.scrolling_frame.grid_rowconfigure(index=0, weight=1)
        self.scrolling_frame.grid_rowconfigure(index=1, weight=1)
        self.scrolling_frame.grid_rowconfigure(index=2, weight=1)
        self.scrolling_frame.grid_rowconfigure(index=3, weight=1)
        self.scrolling_frame.grid_columnconfigure(index=0, weight=1)

But the ScrolledFrame is not adapting to the height of the contents (I think it's just at its default height,) nor are the contents adapting to the width of the ScrolledFrame (they take up about half the width.)

The items inside the frames are being laid out by using:

self.item1.grid(row=0, column=0, padx=0, pady=(0, 10), sticky="nswe")
self.item2.grid(row=1, column=0, padx=0, pady=(0, 10), sticky="nswe")

and so on.. I'd be grateful for suggestions, thanks

Cromwell1963 avatar Jan 11 '23 07:01 Cromwell1963

I have found that if i pack the items in the ScrolledFrame, rather than use the grid, then they will expand to fill the whole row as desired. I am still not getting the height of the ScrolledFrame to adjust to its contents.

Cromwell1963 avatar Jan 11 '23 19:01 Cromwell1963

Ok, so the final problem was nothing to do with the ScrolledEntry. It was nested inside another row that was limiting it's expansion. It took a while to see it, but having sorted that all works ok. thanks

Cromwell1963 avatar Jan 11 '23 20:01 Cromwell1963

Wow I didn't know Ctk had scrollable frames! Does it work well?

kelltom avatar Jan 12 '23 19:01 kelltom

Oops, sorry I posted this to the wrong group. ScrolledFrames are not part of CustomTkinter. Sorry,

Cromwell1963 avatar Jan 12 '23 20:01 Cromwell1963