I'm making a project where I have to display logs in a frame with the help of Tkinter. Here is my code for that particular frame.
# frame3 for logs
frame3 = Frame(
win,
bg='black',
width=310,
height=140,
padx=0,
pady=0)
frame3.pack(fill=X, expand=True, padx=(0, 10), pady=0)
frame3.pack_propagate(0) # stops frame from shrinking
scroll = Scrollbar(frame3)
scroll.pack(side = RIGHT, fill = Y)
The logs are generated and are printed in that frame. Here is the code for generating and printing logs
logs = Label(frame3, text = (time.ctime()), font=("Consolas", 9), bg="#000000", fg="#ffffff")
logs.pack(pady=(0, 0))
The scrollbar is showing but it is somehow not working. The scroll is sliding if I click and slide it with the mouse. I guess there are 3 types of scrollbars in Tkinter (Correct me if I'm wrong).
- window scrollbar.
- Frame scrollbar.
- Label Scrollbar (not sure about that).
I think the problem is that I made is a scrollbar for a frame. But, I need it for Label. Or is there any way by which I can print logs directly onto the frame? Don't know what the actual problem is. Also, is there a way by which I can make it auto scrollable when the logs are generated?
Any help would be greatly appreciated. Thanks in advance.