python tkinter grid布局显示问题求助
展开全部
from tkinter import *
root = Tk()
Label(root,text = "帐号").grid(row = 0,sticky = W)
Label(root,text = "密码").grid(row = 1,sticky = W)
v = StringVar()
v.set("172.0.0.1")
e1 = Entry(root,textvariable = v)
e2 = Entry(root)
e1.grid(row = 0,columns = 1,sticky = E)
e2.grid(row = 1,columns = 1,sticky = E)
Label(root,text = '登录').grid(row = 3,sticky = W+E)
root.mainloop()
上面是代码,但是Label不会显示,搞了一晚上了,找不出问题在哪里,题主是超级小白。。。
root=Tk()后面加上
mainroot = ttk.Frame(root)
mainroot.grid(column=0, row=0, sticky=(N, W, E, S))
root = Tk()
Label(root,text = "帐号").grid(row = 0,sticky = W)
Label(root,text = "密码").grid(row = 1,sticky = W)
v = StringVar()
v.set("172.0.0.1")
e1 = Entry(root,textvariable = v)
e2 = Entry(root)
e1.grid(row = 0,columns = 1,sticky = E)
e2.grid(row = 1,columns = 1,sticky = E)
Label(root,text = '登录').grid(row = 3,sticky = W+E)
root.mainloop()
上面是代码,但是Label不会显示,搞了一晚上了,找不出问题在哪里,题主是超级小白。。。
root=Tk()后面加上
mainroot = ttk.Frame(root)
mainroot.grid(column=0, row=0, sticky=(N, W, E, S))
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询