title: How can i sum the values of checkboxes in python if they were made using a loop?
body: <p>Recently i have made a code which adds checkbuttons based on the items i put in the list.Items in the list consist of String connected to integer, so one window with checkboxes would look like this: London(3.40) New York(2.20) California(1.2) etc.What i would like to do now is make a button that when clicked sums the integers from the checkboxes.
  Note: I have two lists, one list is list of integers <code>Example = [1.2,3.4,2.45,2.4]</code> and other list is list of items <code>Items = [&quot;London&quot;,&quot;New York&quot;,&quot;California&quot;,&quot;Toronto&quot;]</code>, after they have been connected with a loop in another list which consists of Items(Value) i made a loop that generates checkbuttons based on amount of Items from that connected list.</p>
  <p>I do not know how to implement get() function in a loop so that when i click few checkboxes it sums them and prints them through the button Sum.
  In which ways can this be done?</p>
  <p>Example of a code:</p>
  <pre><code>Values = [1.2,3.4,5.4]
  Items = [&quot;London&quot;,&quot;Lisbon&quot;,&quot;Athens&quot;]
  
  Connect = ['%.2f', % i for i in Values]
  
  while i != len(Connect):
      Items[i] = Items[i]+&quot;(&quot; + Connect[i] + &quot;)&quot;
      i = i+ 1
  
  for j in range(len(Values)):
      items = tkinter.Checkbutton(window, text=Items[j], onvalue=1, offvalue=0)
  </code></pre>
  <p>From now on i need to make a function that will sum checked checkboxes and print the sum once button Sum is clicked.
  Thank you for your help in forward!</p>