import tkinter as tk win = tk.Tk() win.title("字符串连接器1.1") win.geometry("400x300") # 标题 title = tk.Label(win,text="Concatenation of Two Stringsn------------------------------------------------------") title.grid(row=0,column=1) # 创建标签一 Lt1 = tk.Label(win,text="word1") Lt1.grid(row=1,column=0) # 创建标签一的输入框 t1 = tk.Entry(win,bd=5) t1.grid(row=1,column=1) # 标签二 Lt2 = tk.Label(win,text="word2") Lt2.grid(row=2,column=0) # 创建标签二的输入框 t2 = tk.Entry(win,bd=5) t2.grid(row=2,column=1) # 定义点击事件 def go(): one = str(t1.get()) two = str(t2.get()) txt = one + two text.insert("end",txt) text.insert("end", "n") # 创建按钮 butt = tk.Button(win,text="Concate the Word",command=go) butt.grid(row=3,column=1) # 创建显示本文框,用来显示连接后的数据 text = tk.Text(win,bd=5,width=30,height=8) text.grid(row=4,column=1) # 循环显示 win.mainloop()
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)