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: - #!/usr/bin/python
-
from Tkinter import *
-
-
class App(object):
-
def __init__(self,parent):
-
fSize = 10
-
self.f = Frame(parent,width=fSize,height=fSize)
-
self.f.pack(padx=15,pady=15)
-
-
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"]
-
self.textInfo1 = StringVar(self.f)
-
self.textInfo1.set(self.Options[0])
-
self.labelInfo1 = apply(OptionMenu, (self.f , self.textInfo1) + tuple(self.Options))
-
self.labelInfo1.pack(side=TOP)
-
-
root = Tk()
-
root.title('Title')
-
app = App(root)
-
-
root.mainloop()
1 5964 bvdet 2,851
Expert Mod 2GB
You cannot do that with an OptionMenu. You can do it with a Listbox though.
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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 ?????...
|
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...
|
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
|
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...
|
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
|
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...
|
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...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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...
|
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,...
| |