It seems `ScrolledFrame` doesn't work for `place layout`.
larryw3i opened this issue · 3 comments
larryw3i commented
Hello, @alejandroautalan , it seems ScrolledFrame
doesn't work for place layout
.
my code:
import tkinter as tk
from pygubu.widgets.scrolledframe import ScrolledFrame
root = tk.Tk()
scrolledframe = ScrolledFrame(
root,
scrolltype="horizontal"
)
prev_x = 0
for i in range(100):
label= Label(
scrolledframe.innerframe,
text="ABCD ")
label.place(x=prev_x, y=0)
prev_x += label.winfo_reqwidth()
scrolledframe.place(x=0, y=0, height=500, width=200)
root.mainloop()
and the widget appears without scrollbar.
Regards.
larryw3i
alejandroautalan commented
Hello @larryw3i thanks for the report.
It seems that the method winfo_reqwidth is not informing correctly about the size of the frame when contains placed children widgets.
import tkinter as tk
root = tk.Tk()
root.geometry("200x500")
frame = tk.Frame(root)
prev_x = 0
for i in range(100):
label= tk.Label(
frame,
text="ABCD ")
label.place(x=prev_x, y=0)
#print(prev_x)
prev_x += label.winfo_reqwidth()
frame.place(x=0, y=0, width=200, height=500)
def print_width():
print(f"Width: {frame.winfo_width()}")
print(f"ReqWidth: {frame.winfo_reqwidth()}")
root.after(800, print_width)
root.mainloop()
Output:
Width: 200
ReqWidth: 1
I will investigate that and find a solution.
Regards
Alejandro A
alejandroautalan commented
As indicated on this page, the place manager does not compute geometric propagation.
Therefore to support place in the ScrolledFrame, the size of the innerframe it has to be calculated manually.
larryw3i commented
@alejandroautalan Ok, It looks normally, I really appreciate your help.