在tkinter中将多余的文本添加到GUI

时间:2020-09-23 16:52:31

标签: python tkinter

我有以下代码用于读取Excel文件,进行简单的计算并在GUI中显示结果。

from tkinter import *
from tkinter import ttk
from tkinter import filedialog
import pandas as pd
window = Tk()
window.title("Welcome Husnain Iqbal")
window.geometry('500x500')
def file_opener():
    input = filedialog.askopenfilename(filetypes=[("Excel files", ".xlsx .xls")])
    cf = pd.read_excel(input,sheet_name = "Classroom")
    mob = cf['Total Number Of Participants']*425
    label = Label(window, text="Participants Mobilization Claim is Rs." + str(mob))
    label.pack()
    
    acc = cf['Total A/C Opened']*25
    label2 = Label(window, text=acc,relief=RAISED)
    
    label2.pack()
    
    
    
x = Button(window, text ='Select File', command = lambda:file_opener())
x.grid(row = 5, column = 1)
x.pack()


mainloop()

它在GUI中添加了额外的0type。我如何摆脱它。 enter image description here

0 个答案:

没有答案
相关问题