Answers for "scrollbar not working tkinter"

14

tkinter make window scrollable

from tkinter import *
class ScrollBar:
    def __init__(self):
        root = Tk()
        h = Scrollbar(root, orient = 'horizontal')
        h.pack(side = BOTTOM, fill = X)
        v = Scrollbar(root)
        v.pack(side = RIGHT, fill = Y)
        t = Text(root, width = 15, height = 15, wrap = NONE,
                 xscrollcommand = h.set,
                 yscrollcommand = v.set)
        for i in range(20):
            t.insert(END,"this is some textn")
        t.pack(side=TOP, fill=X)
        h.config(command=t.xview)
        v.config(command=t.yview)
        root.mainloop()
s = ScrollBar()
Posted by: Guest on March-26-2021

Code answers related to "scrollbar not working tkinter"

Python Answers by Framework

Browse Popular Code Answers by Language