0
我正在使用下面的代碼片段採用from here我需要它等待用戶選擇一個選項,然後將其填入代碼的其餘部分(添加到xml文件-a元數據生成程序我的工作with details here)Tkinter下拉菜單進入無限循環
from Tkinter import *
def print_it(event):
print var.get()
root = Tk()
var = StringVar()
var.set("Set Copyright for: " + str(File))
OptionMenu(root, var, "Internal Use Only","Internal & Community Use","Whole Of Government Use", "Project Specific Licence","No licence constraints on ATGIS/TRC use", command=print_it).pack()
root.mainloop()
這應該是上面的DEF的一部分嗎?
for node in tree.findall('.//copyright'):
node.text = str(var) # not sure how to call the output.
@Hoxieboy - 你的評論被刪除(??)。我不想使用def print_it -I我不太清楚爲什麼它在原始程序中存在,並且當它被註釋掉時腳本不起作用。我只想讓腳本詢問用戶輸入,將其放入xml文件,然後繼續自動填充或根據需要詢問其他問題。 – GeorgeC 2012-02-02 07:00:03