KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
The code below produces an ugly but functional example of using a scroll bar in a text widget and results in a couple of questions. Note: this is done using Python 3 on a windows box. The scroll bar that appears is attached to the frame and although it scrolls the text box contents, I would prefer that it was attached to the text widget itself. I have been unable to get this to happen. There are a number of references to a Tkinter module called "scrolledtext" that is supposed to be a much better mechanism for adding scrollbars to text boxes but, I have not found any examples of how to import it and call it that I am able to get to work (probably need an example). frame1 = tk.Frame(win,width=80, height=80,bg = '#808000') frame1.pack(fill='both', expand='yes') scrollbar = Scrollbar(frame1) scrollbar.pack(side=RIGHT, fill=Y) editArea = Text(frame1, width=10, height=10, wrap=WORD, yscrollcommand=scrollbar.set) editArea.pack() scrollbar.config(command=editArea.yview) editArea.place(x=10,y=30)
Tags (comma-separated)
Save Edits
Cancel