我的代碼是這樣看現在:的Tkinter從按鈕
def browse_button():
ftypes1 = [('file', '*.txt')]
filename1 = filedialog.askopenfilename(filetypes = ftypes1)
print(filename1)
with open(filename1) as newfile1:
file1 = pd.read_table(newfile1, sep=',', names=('A', 'B', 'C'))
print file1
return filename1
def file_button():
abc=browse_button()
print abc
# in this definition i want to work on the input file that
i have imported at start in browse_button definition,but
it doesn't work good
我使用這個代碼來運行他們他們
if __name__ == '__main__':
root = Tk()
root.title('title')
root.geometry("450x150+200+200")
b1 = Button(root, text='one', font=('arial', 12), command=browse_button)
b1.pack(side=LEFT, padx=5, pady=5)
b6 = Button(root, text='file', font=('arial', 12), command=file_button)
b6.pack(side=LEFT, padx=5, pady=5)
感謝您的諮詢!
第一塊被打破 –
@Bryan奧克利,修正的壓痕,我只是把它複製在錯誤的方式,但它仍然犯規解決它似乎是問題 – Pawe