ScrolledFrame Behavior
See original GitHub issueIs this a bug or expected behavior?
This code generates this layout:
import ttkbootstrap as ttk
from ttkbootstrap.constants import *
from ttkbootstrap.scrolled import ScrolledFrame
class MainFrame(ttk.Window):
def __init__(self):
ttk.Window.__init__(self)
self.geometry('500x300')
self.title('Tkinter')
self.set_notebook()
self.set_tab0()
return
def set_notebook(self):
self.nb = ttk.Notebook(self)
self.nb.place(relx=0, rely=0, relwidth=1, relheight=1)
return
def set_tab0(self):
#self.frm = ScrolledFrame(self, autohide=True)
self.frm = ttk.Frame(self)
self.frm.place(relx=0, rely=0, relwidth=1, relheight=1)
##Top
self.frm_top = ttk.Frame(self.frm)
self.frm_top.pack(fill=BOTH, expand=1)
ttk.Label(self.frm_top, text='frame 1: top place (10, 25)').place(x=10, y=25)
ttk.Label(self.frm_top, text='frame 1: top pack').pack()
#middle
self.frm_middle = ttk.Frame(self.frm)
self.frm_middle.pack(fill=BOTH, expand=1)
ttk.Label(self.frm_middle, text='frame 2: middle - pack').pack()
ttk.Label(self.frm_middle, text='frame 2: middle - place (10, 25)').place(x=10, y=25)
#Bottom
self.frm_bottom = ttk.Frame(self.frm)
self.frm_bottom.pack(side=BOTTOM, fill=X)
ttk.Label(self.frm_bottom, text='frame 3: bottom - pack').pack()
#self.nb.add(self.frm.container, text='Test')
self.nb.add(self.frm, text='Test')
return
if __name__== '__main__':
app = MainFrame()
app.mainloop()
Scrolled:
If I replace the frame (self.frm) with a ScrolledFrame, see how the layout changes: the widget with .place was not displayed and the frame side=bottom does not obey the bottom position:
import ttkbootstrap as ttk
from ttkbootstrap.constants import *
from ttkbootstrap.scrolled import ScrolledFrame
class MainFrame(ttk.Window):
def __init__(self):
ttk.Window.__init__(self)
self.geometry('500x300')
self.title('Tkinter')
self.set_notebook()
self.set_tab0()
return
def set_notebook(self):
self.nb = ttk.Notebook(self)
self.nb.place(relx=0, rely=0, relwidth=1, relheight=1)
return
def set_tab0(self):
self.frm = ScrolledFrame(self, autohide=True)
#self.frm = ttk.Frame(self)
self.frm.place(relx=0, rely=0, relwidth=1, relheight=1)
##Top
self.frm_top = ttk.Frame(self.frm)
self.frm_top.pack(fill=BOTH, expand=1)
ttk.Label(self.frm_top, text='frame 1: top place (10, 25)').place(x=10, y=25)
ttk.Label(self.frm_top, text='frame 1: top pack').pack()
#middle
self.frm_middle = ttk.Frame(self.frm)
self.frm_middle.pack(fill=BOTH, expand=1)
ttk.Label(self.frm_middle, text='frame 2: middle - pack').pack()
ttk.Label(self.frm_middle, text='frame 2: middle - place (10, 25)').place(x=10, y=25)
#Bottom
self.frm_bottom = ttk.Frame(self.frm)
self.frm_bottom.pack(side=BOTTOM, fill=X)
ttk.Label(self.frm_bottom, text='frame 3: bottom - pack').pack()
self.nb.add(self.frm.container, text='Test')
#self.nb.add(self.frm, text='Test')
return
if __name__== '__main__':
app = MainFrame()
app.mainloop()
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
scrolledframe - Create and manipulate scrolled frame widgets
Option and the args determine the exact behavior of the command. The following commands are possible for scrolledframe widgets: ...
Read more >scrolledframeSection iwid
scrolledframe - Create and manipulate scrolled frame widgets ... Option and the args determine the exact behavior of the command. The following commands...
Read more >man page(1) - ESO.org
Option and the args determine the exact behavior of the command. The following commands are possible for scrolledframe widgets: Associated Methods.
Read more >ttkwidgets/scrolledframe.py at master - frames - GitHub
A frame that sports a vertically oriented scrollbar for scrolling. :ivar interior: :class:`ttk.Frame` in which to put the widgets to be ...
Read more >scrolledframe.n.html - Apple Open Source
<TITLE>scrolledframe - Create and manipulate scrolled frame ... </pre> <I>Option</I> and the <I>arg</I>s determine the exact behavior of the command.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@antrrax, the scrolled frame has a default width and height like the Canvas widget, however, you can override with pack, place, grid, just as with any other widget.
I’ve added a new parameter called
scrollheight
which sets the height of the content frame manually in the case that you are using a relative positioning such as in the example above.I tested it with the same code as in the first post. At first the problem was solved. Thanks for the quick resolution.