91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 6KB
    文件類型: .py
    金幣: 1
    下載: 1 次
    發布日期: 2021-06-10
  • 語言: Python
  • 標簽: python??sqlite??Tkinter??

資源簡介

Tkinter+SQLite實現賬號密碼存儲。由于生活中用到的賬號密碼太多了,因此開發這個工具,實現賬號密碼存儲在數據庫中,忘記了就可以查詢。

資源截圖

代碼片段和文件信息

#?-*-?coding:utf-8?-*-

from?tkinter?import?*
from?tkinter?import?messagebox
from?PIL?import?ImageImageTk
import?sqlite3

title?=?“提示“

def?main():
global?widthheightbt_query
root?=?Tk()
root.resizable(FalseFalse)
widthheight?=?root.maxsize()
site?=?‘%dx%d+%d+%d‘%(480360(width-480)/2(height-320)/2)
root.geometry(site)?#+%d+%d表示初始化時窗口所在的位置這里是窗口居中顯示
root.title(“Account?Database“)
#背景圖片
bgImg?=?Image.open(‘./bg1_demo.jpg‘)
bgImg?=?ImageTk.PhotoImage(bgImg)
Label(rootimage=bgImg).grid()
#文本控件
Label(roottext=u‘賬號:‘font=(‘楷體‘15)).place(relx=0.12rely=0.25)
en_account_var?=?StringVar()
Entry(roottextvariable=en_account_varwidth=‘25‘fg=‘gray‘relief=GROOVEbd=3).place(relx=0.32rely=0.25)
Label(roottext=u‘密碼:‘font=(‘楷體‘15)).place(relx=0.12rely=0.40)
en_password_var?=?StringVar()
Entry(roottextvariable=en_password_varwidth=‘25‘fg=‘gray‘relief=GROOVEbd=3).place(relx=0.32rely=0.40)
Label(roottext=u‘備注:‘font=(‘楷體‘15)).place(relx=0.12rely=0.55)
en_info_var?=?StringVar()
Entry(roottextvariable=en_info_varwidth=‘25‘fg=‘gray‘relief=GROOVEbd=3).place(relx=0.32rely=0.55)

#Button組件
Button(roottext=‘新增‘bd=2width=5height=1command=lambda:insert(en_info_varen_account_varen_password_var)font=(‘楷體‘13)).place(relx=0.75rely=0.20)
Button(roottext=‘修改‘bd=2width=5height=1command=lambda:update(en_account_varen_password_varen_info_var)font=(‘楷體‘13)).place(relx=0.75rely=0.32)
bt_query?=?Button(roottext=‘查詢‘bd=2width=5height=1command=lambda:query(en_info_var)font=(‘楷體‘13))
bt_query.place(relx=0.75rely=0.44)

Button(roottext=‘刪除‘bd=2width=5height=1command=lambda:delete(en_account_varen_info_var)font=(‘楷體‘13)).place(relx=0.75rely=0.56)

#Menu菜單
menubar?=?Menu(root)
filemenu?=?Menu(menubartearoff=False)
menubar.add_cascade(label=‘更多‘menu=filemenu)
filemenu.add_command(label=‘創建數據表‘font=(‘楷體‘10)command=lambda?:create())
filemenu.add_command(label=‘刪除數據表‘font=(‘楷體‘10)command=lambda:drop())
root.config(menu=menubar)
root.mainloop()

def?create():
try:
cursor.execute(‘‘‘CREATE?TABLE?ACCOUNTINFO?(
ID?INTEGER??PRIMARY?KEY?AUTOINCREMENT????NOT?NULL
INFO??????????CHAR(10)???NOT?NULL
ACCOUNT?????????TEXT?????NOT?NULL
PASSWORD????????TEXT?????NOT?NULL
);‘‘‘)?#?主鍵ID自增長
messagebox.showinfo(title“創建數據表ACCOUNTINFO成功“)
except?Exception?as?e:
messagebox.showinfo(titlee.args[0])
return?False
conn.commit()

def?insert(en_info_varen_account_varen_password_var):
try:
sql?=?“INSERT?INTO?ACCOUNTINFO(INFOACCOUNTPASSWORD)?VALUES?(???)“??#官方建議insert最好用?作為占位符
cursor.execute(sql

評論

共有 條評論