The problem is that the scrollbar is too short and I can’t configure it (I don’t know how) Here’s the code:

from tkinter import* def allrezum(): win = Toplevel(root,relief=SUNKEN,bd=10,bg="lightblue") win.title("Дочернее окно") win.minsize(width=400,height=200) root = Tk() m = Menu(root) root.config(menu=m) fm = Menu(m) m.add_cascade(label="Резюме",menu=fm) fm.add_command(label="Все резюме", command = allrezum) lab1 = Label(root, text="Новое Резюме", font="Arial 22") lab2 = Label(root, text="Имя", font="Arial 18") ent1 = Entry(root,width=20,bd=3) lab3 = Label(root, text="Фамилия", font="Arial 18") ent2 = Entry(root,width=20,bd=3) lab4 = Label(root, text="Город", font="Arial 18") lab5 = Label(root, text="Страна", font="Arial 18") lab6 = Label(root, text="Технологический Стек", font="Arial 18") lab7 = Label(root, text="Должность", font="Arial 18") ent3 = Entry(root,width=20,bd=3) lab8 = Label(root, text="Уровень Английского", font="Arial 18") lab9 = Label(root, text="Комментарии", font="Arial 18") frame2=Frame(root,bg='red',bd=5) tex = Text(frame2,width=20,height=5, font="Verdana 12", wrap=WORD) scr = Scrollbar(frame2,command=tex.yview,) tex.configure(yscrollcommand=scr.set) sca1 = Scale(root,orient=HORIZONTAL,length=300, from_=0,to=100,tickinterval=10,resolution=5) lab1.grid(row=0, column=1) lab2.grid(row=1, column=0) ent1.grid(row=1, column=1) lab3.grid(row=2, column=0) ent2.grid(row=2, column=1) lab4.grid(row=1, column=2) lab5.grid(row=2, column=2) lab6.grid(row=4, column=0) lab7.grid(row=4, column=2) lab8.grid(row=5, column=0) lab9.grid(row=4, column=2) tex.grid(row=5, column=1) sca1.grid(row=6, column=1) frame2.grid(row=5, column=1) scr.grid(row=5, column=2) root.mainloop() 

    1 answer 1

    You need to use for the text field and the scrollbar not the grid , but the packaging inside their frame:

     frame2=Frame(root,bg='red',bd=5) tex = Text(frame2, width=20, height=5, font="Verdana 12", wrap=WORD) scr = Scrollbar(frame2,command=tex.yview,) tex.configure(yscrollcommand=scr.set) scr.pack(side='right', fill='y') # "Прилепить" к правому краю фрейма, заполнять по высоте (ось y) tex.pack(fill='both') # Упаковать в оставшуюся часть фрейма, заполнять по высоте и ширине (both) 

    Below in the code, you need to remove the tex.grid(row=5, column=1) and scr.grid(row=5, column=2) lines, since we already arranged these controls using pack . If not removed, it will produce an error of this type:

    _tkinter.TclError: cannot use geometry grid grid inside .47534160 which has already been managed by pack

    Result:

    Screenshot

    For comparison, how the scrollbar looked like before the change:

    Screenshot

    Update

    An alternative option is to place elements in a frame using the grid :

     tex.grid(row=0, column=0) scr.grid(row=0, column=1, sticky=N+S) # Растягивать полосу прокрутки вверх и вниз 

    Visually does not differ from placement using pack .

    • Thank you so much! - Dmitry