I am developing an application to search in a spreadsheet the open fees of some clients, save it in a dictionary and print it in the graphical interface. The code itself works perfectly, however, when the list gets too big at the end, the rest of the content is cut off. Can you tell me a way to solve it?
from tkinter import *
import openpyxl
root = Tk()
def hono_aberto():
newWindow = Toplevel()
newWindow.title("Output")
newWindow.geometry("400x350+375+50")
# Opens the spreadsheet and obtains the status of the last payment.
wb = openpyxl.load_workbook('C:/temp/cobranca.xlsx')
sheet = wb['Sheet1']
lastCol = sheet.max_column
# latestMonth = sheet.cell(row=1, column=lastCol).value
# Checks the payment status of each customer.
unpaidMembers = {}
clients = []
months = []
emails = []
for r in range(2, sheet.max_row + 1):
for c in range(3, lastCol + 1):
payment = sheet.cell(row=r, column=c).value
if payment != 'ok':
client = sheet.cell(row=r, column=1).value
email = sheet.cell(row=r, column=2).value
month = sheet.cell(row=1, column=c).value
clients.append(client)
months.append(month)
emails.append(email)
unpaidMembers[client] = email
print('Line:', r, 'Column:', c, 'Client:', client, 'Email:', email, 'Month:', month)
#--- LABELS ---#
l_label1 = Label(newWindow, text="Client", font='-weight bold')
l_label1.grid(row=1, column=1)
l_label2 = Label(newWindow, text="Competence", font='-weight bold')
l_label2.grid(row=1, column=2)
l_label3 = Label(newWindow, text="E-mail", font='-weight bold')
l_label3.grid(row=1, column=3)
v_result1 = StringVar()
l_cliente = Label(newWindow, textvariable=v_result1)
l_cliente.grid(row=2, column=1)
v_result2 = StringVar()
l_mes = Label(newWindow, textvariable=v_result2)
l_mes.grid(row=2, column=2)
v_result3 = StringVar()
l_email = Label(newWindow, textvariable=v_result3)
l_email.grid(row=2, column=3)
#--- OUTPUT ---#
v_result1.set('\n'.join(clients))
v_result2.set('\n'.join(months))
v_result3.set('\n'.join(emails))
bt = Button(root, text='Check', command=hono_aberto)
bt.grid(row=1, column=1)
root.mainloop()
Here is a model of the spreadsheet used:https://prnt.sc/123sxpd