每当我执行此代码时,gui 上都不会显示任何内容。如果我使用网格放置标签和按钮,它工作正常。如果我使用 .place 放置标签,它不会显示任何内容。
from Tkinter import *
class Applet(Frame):
""" First attempt to make the program """
def __init__(self, master):
""" initialize the frame """
Frame.__init__(self,master)
self.login()
#self.Signup()
def login(self):
self.Login_username = StringVar()
self.Login_password = StringVar()
self.Label1 = Label(self, text = 'Username: ').place(x = 0, y = 0)
self.Label2 = Label(self, text = 'Password: ').place(x =50, y = 0)
self.loguser = Entry(self, textvariable = self.Login_username, width = 15).place(x = 0, y = 10)
self.logpass = Entry(self, textvariable = self.Login_password, width = 15, show = '*').place(x = 50, y = 10)
self.button = Button(self, text = 'Login').place(x = 400, y = 0)
Top = Tk()
Top.title('test-gui')
app = Applet(Top)
Top.geometry('700x350')
Top.mainloop()