The Python Oracle

What is the correct method to display a large popup menu?

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Ominous Technology Looping

--

Chapters
00:00 What Is The Correct Method To Display A Large Popup Menu?
02:20 Answer 1 Score 2
02:49 Accepted Answer Score 1
03:15 Thank you

--

Full question
https://stackoverflow.com/questions/1442...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #gtk #gtk3 #pygobject

#avk47



ANSWER 1

Score 2


I browsed around a little in the documentation, and instead of using popup.append(new_menu_item) you could use popup.attach(new_menu_item, left, right, top, bottom) to put your menu items in a grid instead of one long line.

But it seems like you would be better off opening a window with a scrollable list, though!




ACCEPTED ANSWER

Score 1


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.