热线电话:13121318867

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

# Create a CLEAR Button and attached

# to del_source function

button1 = Button(root, text = "CLEAR", bg = "red",

fg = "black", command = del_source)

# Create a CLEAR Button and attached to del_destination

button2 = Button(root, text = "CLEAR", bg = "red",

fg = "black", command = del_destination)

# Create a RESULT Button and attached to find function

button3 = Button(root, text = "RESULT", 

bg = "red", fg = "black",

command = find)

# Create a CLEAR ALL Button and attached to delete_all function

button4 = Button(root, text = "CLEAR ALL",

bg = "red", fg = "black",

command = delete_all)

# Create a Train Button and attached to train function

button5 = Button(root, text = "Train", command = train)

# Create a Driving Button and attached to driving function

button6 = Button(root, text = "Driving", command = driving)

# Create a Walking Button and attached to walking function

button7 = Button(root, text = "Walking", command = walking)

# Create a CLEAR Button and attached to del_modes function

button8 = Button(root, text = "CLEAR",

fg = "black", bg = "red",

command = del_modes)

# grid method is used for placing

# the widgets at respective positions

# in table like structure .

button1.grid(row = 1, column = 2)

button2.grid(row = 2, column = 2)

button3.grid(row = 6, column = 1)

button4.grid(row = 9, column = 1)

button5.grid(row = 4, column = 0)

button6.grid(row = 4, column = 1)

button7.grid(row = 4, column = 2)

button8.grid(row = 5, column = 2)

# Start the GUI

root.mainloop()

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

发表评论

暂无数据
推荐帖子