main
LiBo 6 months ago
parent 0c6941f5b4
commit 1e9d533d75

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PySciProjectComponent">
<option name="PY_INTERACTIVE_PLOTS_SUGGESTED" value="true" />
</component>
</project>

@ -63,6 +63,7 @@ class DBHelper:
if __name__ == '__main__':
db = DBHelper()
sql = 'create table films(title varchar(50), actor varchar(200), time varchar(100));'
db.connect()
db.execute(sql, None)
db.close()
logger.removeHandler(file_handler)

@ -34,10 +34,10 @@ def getPage(url):
def insertInfo(item):
db = dp.DBHelper()
_title = item['item']
_title = item['title']
_actor = item['actor']
_time = item['time']
sql = 'insert into films(title, actor, time) values (%s, %s, %s);'
sql = "insert into films(title, actor, time) values (%s, %s, %s);"
params = (_title, _actor, _time)
ok = db.execute(sql, params)

@ -1,57 +0,0 @@
from tkinter import *
user_login = {
'aaa': '123',
'bbb': '654'
}
count = 0
def temp(s):
win = Tk()
win.geometry('100x100')
message = Label(win, text=s)
message.pack()
def login() :
global count
username = entry_username.get()
if username not in user_login:
label_message.config(text='账号错误')
else:
password = entry_password.get()
if password == user_login[username]:
#label_message.config(text='登录成功')
temp('登录成功')
else:
label_message.config(text='密码错误!还可以尝试{}'.format(2 - count))
count += 1
if count == 3:
temp('登陆失败')
btn_login.config(state='disabled')
windon = Tk()
windon.title('用户登录')
windon.geometry('300x200')
label_username = Label(windon, text='账号')
label_username.pack()
entry_username = Entry(windon)
entry_username.pack()
label_password = Label(windon, text='密码')
label_password.pack()
entry_password = Entry(windon, show='*')
entry_password.pack()
btn_login = Button(windon, text='登录', command=login)
btn_login.pack()
label_message = Label(windon, text="")
label_message.pack()
windon.mainloop()
Loading…
Cancel
Save