标签:
1 #!/bin/usr/python 2 #-*- coding:utf-8 -*- 3 4 from Tkinter import * 5 6 class show(object): 7 def __init__(self, master): 8 frame = Frame(master) 9 frame.pack() 10 11 self.button = Button(frame, text=‘ADD‘, command=self.add) 12 self.listbox = Listbox(master) 13 self.listbox.pack(side=LEFT) 14 self.button.pack(side=LEFT) 15 16 self.listbox.insert(END, ‘a list entry‘) 17 18 for item in [‘one‘, ‘two‘, ‘three‘, ‘four‘]: 19 self.listbox.insert(END, item) 20 21 def add(self): 22 self.listbox.insert(END,‘five‘) 23 24 master = Tk() 25 app = show(master) 26 27 master.mainloop()
http://effbot.org/tkinterbook/listbox.htm
python__tkinter之listbox&button
标签:
原文地址:http://www.cnblogs.com/wizzhangquan/p/4312992.html