473,396 Members | 1,913 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

[TKinter] Options menu with scroll arrows?

Hello everyone,

I am trying to make a small GUI with TKinter for python. One widget is an option menu with a large number of items (+50). My code works but shows a large option list with as many items as fit on the screen when I click on the option menu. I'd like that it shows me only a few items (e.g. 5) and allow the user to scroll up and down.

Thanks in advance for your help

The following code can be used for testing:

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/python
  2. from Tkinter import *
  3.  
  4. class App(object):
  5.     def __init__(self,parent):
  6.         fSize = 10
  7.         self.f = Frame(parent,width=fSize,height=fSize)
  8.         self.f.pack(padx=15,pady=15)
  9.  
  10.         self.Options = ["Todos", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56"]
  11.         self.textInfo1 = StringVar(self.f)
  12.         self.textInfo1.set(self.Options[0])
  13.         self.labelInfo1 = apply(OptionMenu, (self.f , self.textInfo1) + tuple(self.Options))
  14.         self.labelInfo1.pack(side=TOP)
  15.  
  16. root = Tk()
  17. root.title('Title')
  18. app = App(root)
  19.  
  20. root.mainloop()
Jan 30 '14 #1
1 5964
bvdet
2,851 Expert Mod 2GB
You cannot do that with an OptionMenu. You can do it with a Listbox though.
Jan 30 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Patrick L. Nolan | last post by:
We have a Tkinter application which has a menubar with cascade submenus. I would like to start the program with one of the submenu items state=DISABLED, then change it to state=NORMAL at a later...
6
by: Bob Greschke | last post by:
Root.option_add("*?????*font", "Helvetica 12 bold") Want to get rid of the "font =": Widget.add_cascade(label = "File", menu = Fi, font = "Helvetica 12 bold") Does anyone know what ?????...
1
by: Gidi | last post by:
hello i have a DataGrid table and by the help of Adnan, here in the forum, i have the Mouse_up Event that by Clicking a row on the dataGrid it's selectes the whole ro the problem is when i'm...
2
by: Phoe6 | last post by:
Hi all, I have this Code Context feature under Options in the IDLE. How should I use it? Are there folks here who use it regularly and find it useful. Please guide me. Thanks! Senthil
2
by: Dustan | last post by:
I don't know if this is because of Tkinter (ie Tk) itself or the Windows default way of handling things, but when I create a very long menu (my test is shown below), the way it displays is rather...
0
by: shipra | last post by:
I have more that 150 submenu item and get a Scroll can i manage the speed of the scroll, as it is too slow
1
by: Carl | last post by:
"Chuckk Hubbard" <badmuthahubbard@gmail.comwrites: Try creating the "main" popup menu before the sub-menus, and when instantiating the sub-menus, pass the main menu as the "master" instead of...
2
by: TheArda | last post by:
Hi i want to create some type of options menu for my program. My Program collects bunch of data from an automated system , records it to an access database and trends it. I want to create an option...
1
by: axluca | last post by:
http://bytes.com/topic/python/answers/882126-grid-view-table-list-tkinter#post3716687 I'm a beginner in python trying to use the nice code you posted. How can I add a simple menu to the app? The...
1
colinod
by: colinod | last post by:
i have a fixed left menu on this page http://www.yaketyyakallmouth.com/newpages2/boys.asp?id=All problem i am having is because of the large page content if your looking on a screen with a low...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.