Hello all,
I'm new to python programming, but am looking for a way to:
- iterate through dictionary keys, asking users to select a map location for the key
- map the new location.x, location.y values to the dictionary
- Select the next dictionary key and continue to map new x, y values until complete.
It's the last item I'm having a problem with. The script (below) either locks on the first key, or whips through all keys incredibly quickly. Can anyone help? Thanks!
city_list = {'city name' : [x, y]}
import math, random
import city_list
from scene import *
city_dict = city_list.city_dict
class MyScene (Scene):
def draw (self):
background(0, 0, 0)
fill(1, 0, 0)
image('_ACKS_ipad_map',0,50)
for key in city_dict:
text('Please select '+str(key)+' on the map',font_name='Helvetica',font_size=15,x=10,y=30,alignment=6)
if len(self.touches) ==0:
return
if len(self.touches) ==1:
location = self.touches.values()[0].location
city_dict[key][0] = location.x
city_dict[key][1] = location.y
text(str(city_dict[key]),font_name='Helvetica',font_size=15,x=10,y=10,alignment=6)
break
run(MyScene())