This is what my gui looks like
这是我的程序代码:
import tkinter
root = tkinter.Tk()
root.resizable(0, 0)
def main_process(directory, reference, dialog):
os.chdir(directory)
SAP = openpyxl.load_workbook(reference)
worksheet_SAP = SAP.worksheets[0]
total_rows_SAP = worksheet_SAP.max_row
total_columns_SAP = worksheet_SAP.max_column
Employees_SAP = []
SAP_employees_working_dates = {}
SAP_employees_working_days = {}
for row in range(2, total_rows_SAP + 1):
working_days = 0
dates = []
employees_SAP = worksheet_SAP.cell(row=row, column=2).value
Employees_SAP.append(employees_SAP)
if employees_SAP not in SAP_employees_working_dates:
SAP_employees_working_dates[employees_SAP] = dates
for days in range(3, total_columns_SAP + 1):
workdays_color = PatternFill(fgColor='00000000')
if worksheet_SAP.cell(row=row, column=days).fill == workdays_color:
if worksheet_SAP.cell(row=row, column=days).value == "":
working_days += 1
date_SAP = worksheet_SAP.cell(row=1, column=days).value
if len(date_SAP) == 1:
date_SAP = "0" + date_SAP
dates.append(date_SAP + "/" + "month" + "/" + "year")
if employees_SAP not in SAP_employees_working_days:
SAP_employees_working_days[employees_SAP] = working_days
Employees_SAP.sort()
""" I want to ask on this section """
while True:
dialog.insert(tkinter.INSERT, ("SAP File Total Rows : ", total_rows_SAP))
dialog.insert(tkinter.INSERT, ("SAP File Total Columns :", total_columns_SAP))
Ask = input("Please Check!\nContinue ? (Y/N)")
if Ask == "Y" or "y":
break
dialog_label = tkinter.Label(root, text="Dialog Box :")
dialog_label.pack()
dialog_box = tkinter.Text(root, height=4, width=50, bd=5)
dialog_box.pack()
automate_button = tkinter.Button(root, text="Automate This Shit!", bg="yellow", fg="red",
command=lambda: main_process(directory_entry.get(),
reference_entry.get(),
dialog_box))
如何使dialog.insert while循环出现在文本小部件上?