Tkinter Scrollbar bad behavior [re. bug #10232]

rantingrick rantingrick at gmail.com
Sat Oct 30 13:53:39 EDT 2010


Robert,

First and foremost if you wish to scroll a window then why not use the
TIX.ScrolledWindow widget instead. It even shows and hides the
scrollbar when necessary.

#-- Start Script --#
from Tix import *
#from Tkconstants import *

class App(Tk): # Must use Tk  for Tix incompability
    def __init__(self):
        Tk.__init__(self)
        self._createWidgets()

    def _createWidgets(self):
        swin = ScrolledWindow(self, width=400, height=300)
        swin.pack(fill=BOTH, expand=1)
        frame = swin.window
        col, row = 0,0
        for row in range(100):
            for col in range(3):
                w=Button(frame, text='This is button (%02d, %02d)' %
(col, row))
                w.grid(row=row, column=col)
                col += 1
            row += 1


if __name__ == '__main__':
    app = App()
    app.mainloop()
#-- End Script --#



More information about the Python-list mailing list