一篇代码了解tkinter

from tkinter import *
import tkinter.messagebox


root =Tk() #生成根窗口
root.title ('小程序')#根窗口标题
root.geometry("800x900+100+200")#根窗口大小及出现位置
root.attributes("-alpha",0.9)#根窗口虚化,值越小越透明
frame1=Frame(root,width=80,heigh=70) #生成一个承载的frame层



entervalue=StringVar(value='value值为默认值')#StringVar().get()和StringVar().set()方法获取和设置
Entry (frame1,textvariable=entervalue).grid (row=1, column=1, stick=E)
Entry (frame1, textvariable=entervalue, show='*').grid (row=2, column=1, stick=E)#show密码样式

Label (frame1, text='Label标签用来显示文字或图片').grid (row=2, stick=W, pady=10)

Button (frame1, text='登陆', command=root.quit).grid (row=3, stick=W, pady=10)
Button (frame1, text='退出', command=frame1.destroy).grid (row=3, column=1, stick=E)



frame1.pack()

root.mainloop()

  

posted @ 2020-10-31 11:42  遥月  阅读(176)  评论(0)    收藏  举报