Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8043151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:48:58+00:00 2026-06-05T04:48:58+00:00

I’m new to this place and tkinter. I am stuck at making a scrollable

  • 0

I’m new to this place and tkinter. I am stuck at making a scrollable listbox or canvas. I have tried both widgets. Within this listbox or canvas, I have several entry and label widgets. The origin point is R0,C0. I used row/columnconfigure to stretch the listbox or canvas.

In the main window, I had 4 buttons on row four to column four (0,4->4,4). I placed the scrollbar on column 5. I attempted to use the grid method. The issue I am having is making the scrollbar functional.

Note: Turning the mainframe into a class is only one of the ways I have tried. Packing the scrollbar on the right has worked, with the listbox/canvas packed on the left. However, the listbox/canvas widget that the scrollbar is commanded to does not scroll the listbox/canvas. Also, adding many entry boxes does not cause the listbox/canvas to scroll. Help please.

from tkinter import *
from tkinter.ttk import *

Style().configure("B.TFrame", relief="flat",
background="blue")
Style().configure("R.TFrame", relief="flat",
background="red")
Style().configure("R.TLabel", background="red")

class Application(Frame): 
    def __init__(self, master=None):
        Frame.__init__(self, master, style="B.TFrame") 
        self.grid(sticky=N+S+E+W) 
        self.mainframe()

    def mainframe(self):
        top=self.winfo_toplevel()
        self.menuBar = Menu(top)
        top["menu"] = self.menuBar
        self.subMenu = Menu(self.menuBar, tearoff=0)
        self.subMenu2 = Menu(self.menuBar, tearoff=0)
        self.menuBar.add_cascade(label="File", menu=self.subMenu)
        self.menuBar.add_cascade(label="About", menu=self.subMenu2)
        self.subMenu.add_command(label="Open")
        self.subMenu.add_command(label="Save")
        self.subMenu.add_command(label="Exit")
        self.subMenu2.add_command(label="About")
        self.subMenu2.add_command(label="Help")



        self.data = Listbox (self, bg='red')
        scrollbar = Scrollbar(self.data, orient=VERTICAL)

        self.add = Button(self, text="")
        self.remove = Button(self, text="")
        self.run = Button(self, text="")
        self.stop = Button(self, text="")

        self.data.grid (row=0, column=0, rowspan=4, columnspan=4, sticky=N+E+S+W)
        self.data.columnconfigure(1, weight=1)
        self.data.columnconfigure(3, weight=1)

        self.add.grid(row=4,column=0,sticky=EW)       
        self.remove.grid(row=4,column=1,sticky=EW)
        self.run.grid(row=4,column=2,sticky=EW)
        self.stop.grid(row=4,column=3,sticky=EW)
        scrollbar.grid(column=5, sticky=N+S)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T04:48:59+00:00Added an answer on June 5, 2026 at 4:48 am

    Without any content in the listbox, there’s nothing to scroll…

    This seems to work though (shortened the example a bit). See also the example at the scrollbar documentation.

    class Application(Frame):   
        def __init__(self,  master=None):
            Frame.__init__(self, master)    
            self.grid(sticky=N+S+E+W)   
            self.mainframe()
    
        def mainframe(self):                
            self.data = Listbox(self, bg='red')
            self.scrollbar = Scrollbar(self.data, orient=VERTICAL)
            self.data.config(yscrollcommand=self.scrollbar.set)
            self.scrollbar.config(command=self.data.yview)
    
            for i in range(1000):
                self.data.insert(END, str(i))
    
            self.run = Button(self, text="run")
            self.stop = Button(self, text="stop")
    
            self.data.grid(row=0, column=0, rowspan=4,
                       columnspan=2, sticky=N+E+S+W)
            self.data.columnconfigure(0, weight=1)
    
            self.run.grid(row=4,column=0,sticky=EW)
            self.stop.grid(row=4,column=1,sticky=EW)
    
            self.scrollbar.grid(column=2, sticky=N+S)
    
    a = Application()
    a.mainframe()
    a.mainloop()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have some data like this: 1 2 3 4 5 9 2 6
Thanks in advance for your help. I have a need within an application to
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a jquery bug and I've been looking for hours now, I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.