Python Forum
[Tkinter] need help in optionMenu using tkinter
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] need help in optionMenu using tkinter
#1
HI..I need help
I got a code which use optionMenu tkinder
the list is too long..It stretch from the full height of the screen

May i know how to limit the number of items to be displayed?Thanks

import sys
import os
from Tkinter import *
import tkMessageBox
root = Tk()
frame = Frame(root, height="200", width="200", bg="blue")
frame.pack()

label = Label(frame,text="""(Above) Constructed (Year):""")
label.pack(padx=5, pady=10, side=LEFT)

constructed_var = StringVar(root)
constructed_var.set("Any") # initial value

options = [
"Any",
"2016",
"2015",
"2014",
"2013",
"2012",
"2011",
"2010",
"2009",
"2008",
"2007",
"2006",
"2005",
"2004",
"2003",
"2002",
"2001",
"2000",
"1999",
"1998",
"1997",
"1996",
"1995",
"1994",
"1993",
"1992",
"1991",
"1990",
"1989",
"1988",
"1987",
"1986",
"1985",
"1984",
"1983",
"1982",
"1981",
"1980",
"1979",
"1978",
"1977",
"1976",
"1975",
"1974",
"1973",
"1972",
"1971",
"1970"
]

constructed_option = OptionMenu(frame, constructed_var,*options)
constructed_option.pack(padx=5, pady=10, side=LEFT)
constructed_option.configure(width=5)

mainloop()
Reply


Messages In This Thread
need help in optionMenu using tkinter - by Lizard - Nov-06-2017, 02:24 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Tkinter reduce OptionMenu height euras 2 4,834 May-25-2021, 09:14 PM
Last Post: euras
  [Tkinter] optionmenu value write a list mdalireza 0 2,356 Nov-11-2019, 01:00 PM
Last Post: mdalireza
  [Tkinter] Retrieve OptionMenu selection? JP_ROMANO 5 23,981 Mar-13-2019, 10:56 AM
Last Post: vsathya
  [Tkinter] [split] need help in optionMenu using tkinter Rakeshkrtiwari_07 0 2,309 Aug-02-2018, 04:16 PM
Last Post: Rakeshkrtiwari_07
  [Tkinter] Tkinter optionmenu child menu position showing 0,0 thatguy14 2 4,767 Jun-15-2018, 10:42 AM
Last Post: thatguy14

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020