Created
March 2, 2018 02:29
-
-
Save PandyYang/d9d4f5754d807af004f9a3cb119c823a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tkinter import * | |
root = Tk() | |
#选项指示说明键 | |
Label(root,text = "作品:").grid(row = 0,column = 0) | |
Label(root,text = "作者:").grid(row = 1,column = 0) | |
v1 = StringVar() | |
v2 = StringVar() | |
#输入框 | |
e1 = Entry(root,textvariable = v1) | |
e2 = Entry(root,textvariable = v2,show = "*") | |
#输入框格式 | |
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