热线电话:13121318867

登录
2019-02-25 阅读量: 606
python如何制作距离时间计算器(2)

# Check value correspondng to

# status key in cell dictionary

if cell['status'] == 'OK' :

# insert method inserting the 

# value in the text entry box.

# Extracting useful information

# from cell dictionary and inserting

# into the respective text fields.

distance_field.insert(10, cell['distance']['text'])

duration_field.insert(10, cell['duration']['text'])

else :

# insert method inserting the

# value in the text entry box.

# Extract value corresponding to

# status key from cell dictionary and

# inserting into the respective text fields.

mode_field.insert(10, cell['status'])

distance_field.insert(10, cell['status'])

# Function for getting values from

# respective text entry boxes and 

# calling result function .                             

def find() :

# get method returns current text 

# as a string from text entry box

source = source_field.get()

destination = destination_field.get()

travel_modes = mode_field.get()

# Calling result() Function

result(source, destination, travel_modes)

# Function for inserting the train string

# in the mode_field text entry box

def train() :

mode_field.insert(10, "train")

# Function for inserting the driving string

# in the mode_field text entry box

def driving() :

mode_field.insert(10, "driving")

# Function for inserting the walking string

# in the mode_field text entry box

def walking() :

mode_field.insert(10, "walking")

# Function for clearing the contents 

# of source_field, distance_field,

# duration_field text entry boxes. 

def del_source() :

source_field.delete(0, END)

distance_field.delete(0, END)

duration_field.delete(0, END)

42.8571
0
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子