本文整理汇总了Python中main.Main.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Main.__init__方法的具体用法?Python Main.__init__怎么用?Python Main.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类main.Main
的用法示例。
在下文中一共展示了Main.__init__方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show_login_window
# 需要导入模块: from main import Main [as 别名]
# 或者: from main.Main import __init__ [as 别名]
def show_login_window(self):
# declaring variables
main = Main()
main.__init__()
lroot = Tk()
lroot.grid()
lroot.title = "Login"
lroot.wm_title("Login")
def login():
name = usrname.get()
passwd = usrpasswd.get()
if self.login_attempts < self.max_login_attempts:
if self.check(name, passwd):
print("User " + name + " logged in successfully")
lroot.destroy()
main.show_main()
print(self.login_attempts)
else:
self.login_attempts += 1
print("User " + name + " cannot be logged in: Wrong username/password")
else:
print("User " + name + " cannot be logged in: Too much login attempts. Login blocked")
# Adding elements to window
# input fields
# username
lbusrname = Label(lroot, text="Username:")
lbusrname.grid(pady=1, padx=1, row=0, column=0)
usrname = Entry(lroot)
usrname.grid(pady=1, padx=1, row=0, column=1)
# password
lbusrpasswd = Label(lroot, text="Passwort:")
lbusrpasswd.grid(pady=1, padx=1, row=1, column=0)
usrpasswd = Entry(lroot, show="*")
usrpasswd.grid(pady=1, padx=1, row=1, column=1)
# buttons
# login
btlogin = Button(lroot, text="Login", command=login)
btlogin.grid(pady=1, padx=1, row=2, column=1, sticky="E")
# closing the window
btquit = QuitButton(lroot)
btquit["text"] = "Schließen"
btquit.grid(pady=1, padx=1, row=2, column=1, sticky="W")
lroot.mainloop()
示例2: __init__
# 需要导入模块: from main import Main [as 别名]
# 或者: from main.Main import __init__ [as 别名]
def __init__(self):
Main.__init__(self)