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 8162727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:49:36+00:00 2026-06-06T18:49:36+00:00

I’m trying to create a scrollbar in part of my program. The parent frame

  • 0

I’m trying to create a scrollbar in part of my program. The parent frame has three label frame widgets, one of which needs to display as many as 50 option menus, making a scrollbar desirable.

I know you can’t use a scrollbar to scroll a label frame, so inside this label frame I’ve created a canvas, which can be scrolled. I’ve then inserted a frame inside the canvas, which I’ll use to display the option menus. I then attach a scrollbar to the canvas, and the scrollbar is placed inside the label frame. The problem is that the scrollbar looks functional, but only the first 10 option menus are visible, no matter how much it appears I’ve scrolled. Here is an example below:

from Tkinter import *

app = Tk()
app.title("Example App")
app.geometry("550x400+300+300")

# Creating the first label frame
entryframe = LabelFrame(app,text="Entry",width=250,height=250)
entryframe.pack(side="top",fill=BOTH)

# Creating a frame to contain the options selected by the user; also using a canvas & 
# label frame to enable the use of a scrollbar
outcomesframe = LabelFrame(app,text="User Input",width=250,height=650)
outcomesframe.pack(side="left",fill=BOTH)
outcomescanvas = Canvas(outcomesframe,relief=SUNKEN)
outcomescanvas.config(width=230,height=650)
outcomescanvas.config(scrollregion=(0,0,300,1000))
outcomescanvas.config(highlightthickness=0)

# Creating scrollbar
scrollbar = Scrollbar(outcomesframe)
scrollbar.config(command=outcomescanvas.yview)
outcomescanvas.config(yscrollcommand=scrollbar.set)
scrollbar.pack(side="right",fill=Y)
outcomescanvas.pack(side="left",expand=YES,fill=BOTH)

# Creating the frame in which the option menus will be inserted
outcomesframe2 = Frame(outcomescanvas,width=230,height=1000)
outcomesframe2.pack(side="top",fill=BOTH)

# Creating the third label frame
statsframe = LabelFrame(app,text="Third Label Frame",width=250,height=250)
statsframe.pack(side="right",fill=BOTH)

# Creating the option menus
for i in range(50):
    vars()["labeltext"+str(i)] = StringVar()
    vars()["labeltext"+str(i)].set("Menu"+str(i+1)+":")
    vars()["label"+str(i)] = Label(outcomesframe2,textvariable=vars()["labeltext"+str(i)])
    vars()["label"+str(i)].grid(row=i,column=0)

    vars()["variable"+str(i)] = StringVar()
    vars()["variable"+str(i)].set("Select...")
    vars()["menu"+str(i)] = OptionMenu(outcomesframe2,vars()["variable"+str(i)],"Option1","Option2")
    vars()["menu"+str(i)].pack()

app.mainloop()
  • 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-06T18:49:37+00:00Added an answer on June 6, 2026 at 6:49 pm

    When you scroll a canvas, it only scrolls items that are canvas objects. That means you must use create_window to place a window in the canvas, rather than using pack or grid.

    ...
    outcomescanvas.create_window(0,0,window=outcomesframe2, anchor="nw")
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace

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.