[Python] how to make vertical and horizontal scrollbar with python tkinter on grid

Discussão em 'Python' iniciado por Stack, Agosto 22, 2025.

  1. Stack

    Stack Membro Participativo

    I have some problem making scrollbar on grid. Most codes use pack and I never really used canvas but I think I have to somehow include it. I am quite new to programming.Thank you for any help.

    tkinter import *

    class test():

    def add_label(self, name, row, column):
    return Label(self.master, text=name, width=11, height=1, borderwidth=1, relief="groove",
    font=("Helvetica", 12), fg="black",
    bg="white", ).grid(row=row, column=column, sticky='nesw')

    def __init__(self, master):
    # constructor
    self.master = master
    for x in range(6):
    for y in range(21):
    Grid.columnconfigure(master, x, weight=1)
    Grid.rowconfigure(master, y, weight=1)

    master.title("Emotion test")
    master.geometry('1100x500')
    master.iconbitmap(r'emotion test icon.ico')
    master.minsize(1100, 500)

    root = Tk()

    obj = test(root)

    root.mainloop()

    Continue reading...

Compartilhe esta Página