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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:37:01+00:00 2026-06-15T13:37:01+00:00

I am noticing some strange behavior from a gtk.Table. Try running this code: import

  • 0

I am noticing some strange behavior from a gtk.Table. Try running this code:

import gtk

class Scrollbar:
    def __init__(self):
        window = gtk.Window()
        window.set_default_size(200, 200)

        button1 = gtk.Button("Button 1")
        button2 = gtk.Button("Button 2")

        table = gtk.Table(20, 20)
        for i in xrange(20):
            for j in range(20):
                table.attach(gtk.Label("%d, %d" % (i, j)), i, i+1, j, j+1, 
                    gtk.FILL | gtk.SHRINK, gtk.FILL | gtk.SHRINK)

        viewport = gtk.Viewport()
        viewport.add(table)

        vadjust = viewport.get_vadjustment()
        hadjust = viewport.get_hadjustment()        

        vscroll = gtk.VScrollbar(vadjust)
        hscroll = gtk.HScrollbar(hadjust)

        superTable = gtk.Table(2, 2, False)
        superTable.attach(viewport, 0, 1, 0, 1, gtk.FILL | gtk.EXPAND, gtk.FILL | gtk.EXPAND)
        superTable.attach(vscroll, 1, 2, 0, 1, gtk.FILL | gtk.SHRINK, gtk.FILL | gtk.SHRINK)
        superTable.attach(hscroll, 0, 1, 1, 2, gtk.FILL | gtk.SHRINK, gtk.FILL | gtk.SHRINK)

        window.add(superTable)

        window.connect("destroy", lambda w: gtk.main_quit())
        window.show_all()

Scrollbar()
gtk.main()

When I try this, the minimum size of the window becomes large enough to accommodate the whole Table without scrolling, which becomes impractical for large Tables. If I use a ScrolledWindow this doesn’t happen. Why? (This question has to do with an application with more complicated scrolling behavior, where I can’t just use a ScrolledWindow)

  • 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-15T13:37:03+00:00Added an answer on June 15, 2026 at 1:37 pm

    You can add viewport.set_size_request(x, y), that activates scrolling if the table becomes larger than the viewport size.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm noticing some strange behavior when I add a ComboBox to my Windows Form
I'm noticing some behavior that I don't like, and I'm wondering if this is
In some Python code I've read I keep noticing this code: return dict(somekey=somevalue) Does
Hi I'm noticing some odd behavior with the following code snippet function test {
I'm noticing some strange results with date conversions between MYSQL and PHP. Please see
I am noticing some weird behavior in my script, not sure why its occurring
I have a work around for this problem, but I've been noticing some peculiar
I started noticing strange behavior when navigating the main toolbar of my Winforms application,
I'm trying to add authentication to my Express-based server. I am noticing some strange
So I've been noticing some strange results in how google peruses our site. One

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.