我是 tkinter 新手并尝试了一个简单的 Tkinter GUI,但出现错误:
TypeError:“NoneType”对象不可调用
这是我的代码:
from tkinter import *
from tkinter import filedialog
import pandas as pd
import pyodbc
from sqlalchemy import create_engine
import urllib
master = Tk()
master.title("Demo GUI")
master.geometry("900x400+150+150")
master.resizable(0,0)
def browse_file():
global file_path
global data_frame
file_path = filedialog.askopenfilename(title = "Choose the file to upload")
data_frame = pd.read_excel(file_path)
Label = Label(master,text="Choose the file to upload").grid(row=0)
Button = Button(master,text='Browse',command = browse_file).grid(row=0,column=1,pady=4)
Label_1 = Label(master,text="The file selected: "+file_path).grid(row=1,column=0)
master.mainloop()
我得到的错误是,
TypeError Traceback (most recent call last)
<ipython-input-29-451372edd65a> in <module>
25 Button = Button(master,text='Browse',command = browse_file).grid(row=0,column=1,pady=4)
26
---> 27 Label1 = Label(master,text="The file Choosen: "+file_path).grid(row=1,column=0)
28
29
TypeError: 'NoneType' object is not callable
qq_花开花谢_0
青春有我
30秒到达战场
相关分类