I made a text box inside the graphic window called win with the name text1. I need to add a vertical scroll bar with the name scrollbar to the text1 window, but the bar does not go where it should, but appears in the main win window (Figure 1). If I make the scroll bar with the object not win, a text1, then the bar rises where it should, but does not work correctly - tell me how to fix it. I can not find solutions.

picture 1

This is a program code with a scrollbar being a win1 object.

from tkinter import* import tkinter win=Tk() win.title('Konvertor') win.minsize(width=600, height=600) win.maxsize(width=600, height=600) label3 = Label(win, text="Результат работы", height=1, font= "Arial 10", bd=1) label3.place(relwidth=0.55, relx=0.7, rely=0.14, anchor="center") scrollbar = Scrollbar(win) scrollbar.pack(side=RIGHT, fill=Y) text1 = Text(win, padx=4) text1.place(relheight=0.7, relwidth=0.55, relx=0.7, rely=0.16, anchor="n", bordermode=OUTSIDE) scrollbar['command'] = text1.yview text1['yscrollcommand'] = scrollbar.set win.mainloop() 

This is a program code with a scrollbar being a text1 object.

 from tkinter import* import tkinter win=Tk() win.title('Konvertor') win.minsize(width=600, height=600) win.maxsize(width=600, height=600) label3 = Label(win, text="Результат работы", height=1, font= "Arial 10", bd=1) label3.place(relwidth=0.55, relx=0.7, rely=0.14, anchor="center") text1 = Text(win, padx=4) text1.place(relheight=0.7, relwidth=0.55, relx=0.7, rely=0.16, anchor="n", bordermode=OUTSIDE) scrollbar = Scrollbar(text1) scrollbar.pack(side=RIGHT, fill=Y) scrollbar['command'] = text1.yview text1['yscrollcommand'] = scrollbar.set win.mainloop() 

drawing 2

  • How to understand is not working correctly? Do you need to appear and disappear in specific situations? (in terms of if the text goes beyond the text does the band appear?) - Twiss
  • Hold Enter in the text box and see that the scrollbar works: i.stack.imgur.com/9Zm4B.png - insolor
  • why doesn't the strip look like a normal strip? there is even no slider in it. And why is there no default slider on it? To make it appear, you have to press it. It shouldn't be like this - Carolina
  • The scroll bar looks like a normal bar when it has nothing to scroll (really, why the slider, if there is nothing to scroll?). Just most text editors hide it in these cases. - insolor

0