【发布时间】:2015-06-23 01:36:38
【问题描述】:
我使用 Tkinter (python 2.7.10) 创建了一个条目小部件网格。我想要这样,如果我从 excel 文件中复制和粘贴不同的单元格,这些单元格也会粘贴到小部件中的单独单元格中。这是实际创建小部件的一小段代码。
root = Tk()
#create an array of height entries
height = 5
width = 5
for i in range(1,height+1): #Rows
for j in range(width): #Columns
b = Entry(root, text="")
b.grid(row=i, column=j)
#initialize column headers
Label(root, text="Plan ID").grid(row=0, column=0, sticky=W)
Label(root, text="WACOG").grid(row=0, column=1, sticky=W)
Label(root, text="Margin").grid(row=0, column=2, sticky=W)
Label(root, text="Start Date").grid(row=0, column=3, sticky=W)
Label(root, text="State").grid(row=0, column=4, sticky=W)
excelise = Button(root, text="Excelise!", command=writeToExcel).grid(row=height+1, column=4)
xmlise = Button(root, text="XMLise!", command=writeToXML).grid(row=height+1, column=3)
mainloop()
现在,当我粘贴时,所有不同的 excel 条目都粘贴到一个条目小部件单元格中。
【问题讨论】:
标签: python excel python-2.7 tkinter