0

I'm currently working on an app for basketball stats on tkinter. It requires the user to enter a bunch of data into many entry's like a data table. However, it forces me to use the .grid option rather than .pack(), at the moment of creating the table.

I made a short version of my program's code. Inside it, I made a "Scrollable Frame" with the create_window option of a Canvas widget. My problem is that i can't set the scrollbar as long as the frame.

from tkinter import*
import tkinter.ttk as ttk 
from ttkthemes import themed_tk as tk


raiz=tk.ThemedTk()
raiz.title("StatsApp")

tab_parent=ttk.Notebook(raiz)
tab2=ttk.Frame(tab_parent, width=1064, height=800)
tab_parent.add(tab2, text="Individuales")
tab_parent.pack(expand=1, fill="both")

experimento=Canvas(tab2)
scrollbarexperimento=ttk.Scrollbar(tab2, orient="vertical", command=experimento.yview)
scrollableframe=ttk.Frame(experimento)

for i in range(20):
    Label(scrollableframe, text='label %i' % i).pack()

experimento.configure(yscrollcommand=scrollbarexperimento.set)
experimento.create_window((0, 0), window=scrollableframe, anchor="nw")
experimento.update_idletasks()
experimento.configure(scrollregion=experimento.bbox('all'),
                      yscrollcommand=scrollbarexperimento.set)
experimento.grid(row=0, column=0, rowspan=200)

scrollbarexperimento.grid(row=0, column=20, sticky=E, rowspan=30)
raiz.mainloop()  

Here a screenshot of my issue:

My issue

Any idea? I would appreciate any help. Thanks!

FBruzzesi
  • 6,385
  • 3
  • 15
  • 37
  • 1
    You need to set `sticky=NS` and `rowspan=200` (same as canvas) in `scrollbarexperimento.grid(...)`. – acw1668 Apr 23 '20 at 07:29
  • 1
    Why do you use `rowspan=` at all? Read [tkinter gui layout using frames and grid](https://stackoverflow.com/a/34277295/7414759), focus at **`grid_rowconfigure(...`** – stovfl Apr 23 '20 at 08:57

0 Answers0