[Tutor] problem with scroll in Tkinter

Peter Otten __peter__ at web.de
Fri Jan 13 05:42:52 EST 2017


Ali Moradi wrote:

> https://paste.pound-python.org/show/CIKA8eOFbdq18r3nFUBv/
> 
> On Fri, Jan 13, 2017 at 10:25 AM, Ali Moradi <adeadmarshal at gmail.com>
> wrote:
> 
>> hi. I've written this code and i can't fix the scrollbar error. i am a
>> beginner in Python plz help. this is python3 code.

According to

http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/listbox-scrolling.html

yscrollcommand has to be configured on the list box, i. e. instead of

self.scrollbar.config(yscrollcommand=self.listbox.yview)

you need

self.listbox.config(yscrollcommand=self.scrollbar.set)

Other problems:

* Chaining grid doesn't work; self.text is set to None here:

        self.text = tk.Text(self.frame_content, width=60, 
height=30).grid(row=1, column=1)

* You access self.db before you set it.
* column=1 is used for both Scrollbar and Text widget.



More information about the Tutor mailing list