Nov-06-2017, 02:24 PM
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
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()