Skip to content

Instantly share code, notes, and snippets.

@PandyYang
Created March 2, 2018 02:30
Show Gist options
  • Save PandyYang/f11d633ad745e841a7417fbc66fb8d10 to your computer and use it in GitHub Desktop.
Save PandyYang/f11d633ad745e841a7417fbc66fb8d10 to your computer and use it in GitHub Desktop.
from tkinter import *
root = Tk()
#选项指示说明键
Label(root,text = "作品:").grid(row = 0,column = 0)
Label(root,text = "作者:").grid(row = 1,column = 0)
#输入框
e1 = Entry(root)
e2 = Entry(root)
#输入框格式
e1.grid(row = 0,column = 1,padx = 10,pady = 5)
e2.grid(row = 1,column = 1,padx = 10,pady = 5)
def show():
print("作品:《%s》" %e1.get())
print("作者:%s" % e2.get())
#按钮
Button(root,text="获取信息",width=10,command=show)\
.grid(row = 3,column = 0,sticky = W,padx = 10,pady = 5)
Button(root,text = "退出",width = 10,command=root.quit)\
.grid(row = 3,column = 1,sticky = E,padx = 10,pady = 5)
mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment