#! /usr/bin/python
#-*-code: utf8 -*-
From Tkinter import *
Category Selection (Framework):
def __init__(self,master=None):
Frame. __init__ (self, master)
Self.label = Label(self,text= "select item ")
self.listBox = Listbox(self,height= 1)
self.button = Button(self,text='V ',command=self.triggle)
self.hideList = True
For I in xrange( 10):
self.listBox.insert(i,' Item%d'%i '
self.label.grid(row=0,column=0,sticky=N)
self.listBox.grid(row=0,column= 1,sticky=N)
self.button.grid(row=0,column=2,sticky=N)
self.grid()
Define a trigger (itself):
^= 1
self . listbox . config(height =[self . listbox . size(), 1][self.hideList])
app = Select()
App.mainloop () is for reference only.