python两列时间间隔计算器_python如何计算距离时间计算器(3)

# Function for clearing the contents of

# destination_field, distance_field,

# duration_field text entry boxes.

def del_destination() :

destination_field.delete(0, END)

distance_field.delete(0, END)

duration_field.delete(0, END)

# function for clearing the contents of mode_field,

# distance_field, duration_field text entry boxes.

def del_modes() :

mode_field.delete(0, END)

distance_field.delete(0, END)

duration_field.delete(0, END)

# Function for clearing the

# contents of all text entry boxes

def delete_all() :

source_field.delete(0, END)

destination_field.delete(0, END)

mode_field.delete(0, END)

distance_field.delete(0, END)

duration_field.delete(0, END)

# Driver code

if __name__ == "__main__" :

# Create a GUI window

root = Tk()

# Set the background colour of GUI window

root.configure(background = 'light green')

# Set the configuration of GUI window

root.geometry("500x300")

# Create a welcome to distance time calculator label

headlabel = Label(root, text = 'welcome to distance time calculator',

fg = 'black', bg = "red")

# Create a Source: label

label1 = Label(root, text = "Source:",

fg = 'black', bg = 'dark green')

# Create a Destination: label

label2 = Label(root, text = "Destination:",

fg = 'black', bg = 'dark green')

# Create a Choose travelling modes: label

label3 = Label(root, text = "Choose travelling modes: ",

fg = 'black', bg = 'red')

# Create a Distance: label

label4 = Label(root, text = "Distance:",

fg = 'black', bg = 'dark green')

# Create a Duration: label

label5 = Label(root, text = "Duration:",

fg = 'black', bg = 'dark green')

# grid method is used for placing

# the widgets at respective positions

# in table like structure .

headlabel.grid(row = 0, column = 1)

label1.grid(row = 1, column = 0, sticky ="E")

label2.grid(row = 2, column = 0, sticky ="E")

label3.grid(row = 3, column = 1)

label4.grid(row = 7, column = 0, sticky ="E")

label5.grid(row = 8, column = 0, sticky ="E")

# Create a text entry box

# for filling or typing the information.

source_field = Entry(root)

destination_field = Entry(root)

mode_field = Entry(root)

distance_field = Entry(root)

duration_field = Entry(root)

# grid method is used for placing

# the widgets at respective positions

# in table like structure .

# ipadx keyword argument set width of entry space .

source_field.grid(row = 1, column = 1, ipadx ="100")

destination_field.grid(row = 2, column = 1, ipadx ="100")

mode_field.grid(row = 5, column = 1, ipadx ="50")

distance_field.grid(row = 7, column = 1, ipadx ="100")

duration_field.grid(row = 8, column = 1, ipadx ="100")

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值