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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:35:45+00:00 2026-06-17T14:35:45+00:00

A picture paints a thousand words…: In my Python 2.7 application I have a

  • 0

A picture paints a thousand words…:

enter image description here

In my Python 2.7 application I have a button which when clicked pops up a menu.

In some circumstances this list is larger than the screen size.

  • In Ubuntu 12.04 (uses Gtk 3.4.2) this is OK because you get scroll-arrows (as shown on the right of the picture).

  • In Ubuntu 12.10/13.04 and Fedora 17 (uses Gtk 3.6) I get the same menu but with no scroll-arrows and you cannot scroll up or down using the mouse.

The strange part is that if I click the button again – the scroll arrows reappear.

So it looks like some-sort of size-allocation issue – its not been calculated on first-popup but is on subsequent pop-up’s

Hence my question

Something obviously has changed with newer GTK libraries – what is now the correct method to display a large popup menu to ensure the scroll arrows are displayed?

Any hints how I should tackle this apparent difference between different GTK versions so that I can get a consistent "show arrows on first click"?

Below is a simple python test program that demonstrates this issue.

I couldn’t use GTKParasite to diagnose this because the popup disappears as soon as you click the "Inspect" button on GtkParasite itself.

# -*- Mode: python; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; -*-

#!/usr/bin/env python

from gi.repository import Gtk

def popupclick(self, *args):
    popup.popup(None, None, None, None, 0,
            Gtk.get_current_event_time())

window = Gtk.Window()
window.connect('delete_event', Gtk.main_quit)
window.set_default_size(200,200)

first_item = None
popup = Gtk.Menu()

for i in range(100):
    label = 'Item %d' % i
    if not first_item:
        new_menu_item = Gtk.RadioMenuItem(label=label)
        first_item = new_menu_item
    else:
        new_menu_item = Gtk.RadioMenuItem.new_with_label_from_widget(
            group=first_item, label=label)

    new_menu_item.show()
    popup.append(new_menu_item)
    
button = Gtk.Button()
button.connect('clicked', popupclick)
mainbox = Gtk.Box()
mainbox.pack_start(button, True, True, 0)
scroller = Gtk.ScrolledWindow()
scroller.add_with_viewport(mainbox)
window.add(scroller)
    
window.show_all()

Gtk.main()
  • 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-17T14:35:46+00:00Added an answer on June 17, 2026 at 2:35 pm

    Use a GtkComboBoxText. But as ptomato said, this kind of presentation isn’t adapted to lists of a huge amount of values. Either reduce the number of values to show, or use a GtkTreeView, which will have a scroll bar and won’t need an initial click to show values.

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

Sidebar

Related Questions

I have a form with a picturebox which displays a picture and some overlay
A picture says more than a thousand words. As you can see, my fill
I have a picture control which is called IDC_PICTURECONTROL , and a LPPICTURE which
I have a picture (bitmap) and I want to draw some shapes and rotated
I'm building application, which paints raw bitmap images on label's hdc using StrechDIBits. ptr
I wrote a test program to monitor my Picture folder which points to c:\users[username]\Pictures
I have a custom UserControl with a custom DependencyProperty. To paint a better picture
Picture the following situation. I have an XML document as follows, <Form> <Control Type=Text
Picture says 1000 words: http://d.pr/ZeBI Basically in most other browsers, when focus on the
A picture is supposed to be worth a 1000 words, so let's see if

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.