I have a list of dictionaries of clients in a format like this:
dict_list = [{'Name of Business' : 'Amazon', 'Contact Name' : 'Jeff Bezos', 'Email' : '[email protected]'}, {'Name of Business' : 'Microsoft', 'Contact Name' : 'Bill Gates', 'Email' : '[email protected]'}]
and will be using tkinter
to build rows for each client with a checkbox
next to each. I will later add a button
that, when pressed, will send an email to each client based on the information it pulls from the list.
Currently I am doing something like:
ClientCount = len(dict_list)
CurrentCount = 0 while CurrentCount < ClientCount:for i in range(ClientCount):currentClient = Label(text='Client: ' + dict_list[i]['Client']).grid(row=[i], column=1)currentContactName = Label(text='Contact Name: ' + dict_list[i]['Contact Name']).grid(row=[i], column=2)currentEmail = Label(text='Contact Email: ' + dict_list[i]['Email']).grid(row=[i], column=3)CurrentCount += 1
First, I am sure there is an easier way to do this and will take any suggestions towards that but the main issue is adding a checkbox that will, when selected, determine whether or not to send an email to that client.
(A button, added later, will call a command that will check if each client is checked and only send to those that return true etc.)
I am not sure whether I should be creating a new variable to be checked, adding a key and a value to each dictionary to be read at a later point, etc.