国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

學(xué)校圖書借閱管理系統(tǒng)(python + sql serve)數(shù)據(jù)庫(kù)大作業(yè)

這篇具有很好參考價(jià)值的文章主要介紹了學(xué)校圖書借閱管理系統(tǒng)(python + sql serve)數(shù)據(jù)庫(kù)大作業(yè)。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問(wèn)。

最近學(xué)校數(shù)據(jù)庫(kù)原理結(jié)課,需要做一個(gè)大作業(yè),還要求寫圖形化界面,現(xiàn)在分享我的源碼,有很多不足之處我也懶的改了,給大家參考一下

具體要實(shí)現(xiàn)的功能為圖書,讀者信息的增刪查改,借書還書觸發(fā)器更改實(shí)時(shí)庫(kù)存,超時(shí)罰款繳納等下面是我的sql代碼和python代碼

學(xué)校圖書借閱管理系統(tǒng)(python + sql serve)數(shù)據(jù)庫(kù)大作業(yè)

圖書信息(book_information):圖書編號(hào)(book_id),圖書名(book_name),作者(author),類別(book_category),出版社(publisher),圖書總數(shù) ? ( book_total)?
讀者信息表(reader_information):讀者編號(hào)(reader_id),姓名(reader_name),所在班級(jí)(reader_class),讀者類別(reader_category),該類別讀者可借閱冊(cè)數(shù)(reader_borrowednumber),
圖書庫(kù)存表(book_inventory):圖書編號(hào)(book_id),剩余庫(kù)存數(shù)(book_surplus)
讀者繳費(fèi)表(reader_payment):讀者編號(hào)(reader_id),待繳罰款(reader_fine)
讀者借書表(reader_borrow):讀者編號(hào)(borrow_id),所借書籍名稱(borrow_bookname)借書時(shí)間(borrow_date)
讀者還書表(reader_back):讀者編號(hào)(back_id),所還書籍名稱(back_bookname),還書時(shí)間(back_date)

CREATE TABLE book_information (
? ? book_id INT PRIMARY KEY,?
? ? book_name NVARCHAR(50) NOT NULL,?
? ? author NVARCHAR(100) NOT NULL,?
? ? book_category NVARCHAR(50),?
? ? publisher NVARCHAR(50),
? ? book_total int
?? ?)--圖書信息表

create table reader_information(
reader_id INT PRIMARY KEY,?
reader_name NVARCHAR(50) NOT NULL,?
reader_class int NOT NULL,?
reader_category NVARCHAR(50)not null,?
reader_borrowednumber int not null

)--讀者信息表
create table book_inventory(
book_id INT PRIMARY KEY,?
book_surplus int NOT NULL,?
)--圖書庫(kù)存表

create table reader_payment(
reader_id varchar(20) PRIMARY KEY,?
reader_fine int NOT NULL,?
)--讀者罰款表

create table reader_borrow(
borrow_id NVARCHAR(50), --為了比較成功運(yùn)行觸發(fā)器,borrow_id為借書人的名字
borrow_bookname NVARCHAR(50) NOT NULL,?
borrow_date date ,
)--讀者借書表

create table reader_back(
back_id NVARCHAR(50), --為了比較成功運(yùn)行觸發(fā)器,borrow_id為借書人的名字
back_bookname NVARCHAR(50) NOT NULL,?
back_date date ,
)--讀者還書表


create view book_select(書號(hào),書名,總數(shù),在館冊(cè)數(shù))--圖書信息查看視圖
as select book_information.book_id,book_information.book_name,book_information.book_total,book_inventory.book_surplus
from book_inventory,book_information
where book_inventory.book_id=book_information.book_id

create trigger tri_jieshu on reader_borrow --借書觸發(fā)器更改庫(kù)存
for insert?
as
declare @id varchar(50)
select @id=borrow_id from inserted
update book_borrowing set book_surplus=book_surplus-1?
where book_id=@id


create trigger tri_huanshu on reader_back --還書觸發(fā)器更改庫(kù)存
for insert?
as
declare @id varchar(50)
select @id=back_id from inserted
update book_borrowing set book_surplus=book_surplus+1?
where book_id=@id

--借書還書存儲(chǔ)過(guò)程返回借書日期和還書日期,返回值用列表的兩個(gè)值相減得出超時(shí)天數(shù)計(jì)算罰款值,交罰款的時(shí)候先插入還書記錄。獲取還書時(shí)間,還書表和借書表連接創(chuàng)建視圖,如果還書時(shí)間減借書日期大于7,選中這個(gè)人,
?create proc payment @id varchar(20),@name varchar(20)
as
?? ?begin
?? ??? ?select borrow_date,back_date from reader_back,reader_borrow?? ?
?? ??? ?where back_id=borrow_id and back_id=@id and borrow_bookname=back_bookname and (select datediff(day, borrow_date,back_date) FROM ?reader_back,reader_borrow)>7
?? ??? ?

?? ?end

--連接借書還書表創(chuàng)建視圖
create view view_pay as select * from reader_back,reader_borrow where (borrow_id=back_id and borrow_bookname=back_bookname)
--創(chuàng)建存儲(chǔ)過(guò)程通過(guò)傳入?yún)?shù)id找到他的借書記錄
create proc proc_pay (@id varchar(20))
as?
select back_id,back_bookname,back_date,borrow_date from view_pay
where back_id=@id?

exec proc_pay
@id='1'
import tkinter as tk
from tkinter import messagebox  # import this to fix messagebox error
from tkinter import StringVar
import pickle
import pymssql
import datetime

def conn():
    serverName = '127.0.0.1'    #目的主機(jī)ip地址
    userName = 'sa'            #SQL Server身份賬號(hào)
    passWord = '1234567'        #SQL Server身份密碼
    dbName = 'classwork'                #對(duì)應(yīng)數(shù)據(jù)庫(kù)名稱
    # dbName = 'teach'                #對(duì)應(yīng)數(shù)據(jù)庫(kù)名稱
    connect = pymssql.connect(server = serverName , database = dbName,charset='utf8') #Window默認(rèn)身份驗(yàn)證建立連接

    return connect
conn=conn()
cursor=conn.cursor()

def menu():

    menu1 = tk.Tk()
    menu1.title('圖書管理系統(tǒng)')
    menu1.geometry('700x400')
    l = tk.Label(menu1, text='你好!歡迎使用圖書管理系統(tǒng)', bg='green', font=('Arial', 12), width=30, height=2)
    l.pack()
    var = tk.StringVar()    # 將label標(biāo)簽的內(nèi)容設(shè)置為字符類型,用var來(lái)接收hit_me函數(shù)的傳出內(nèi)容用以顯示在標(biāo)簽上

    function1 = tk.Button(menu1, text='1.圖書信息管理', font=('Arial', 12), width=15, height=1, command=fun1,)
    function1.pack(expand=True)
    function2 = tk.Button(menu1, text='2.讀者信息管理', font=('Arial', 12), width=15, height=1, command=fun2)
    function2.pack(expand=True)
    function3 = tk.Button(menu1, text='3.圖書借閱管理', font=('Arial', 12), width=15, height=1, command=fun3)
    function3.pack(expand=True)
    function4 = tk.Button(menu1, text='4.超時(shí)罰款繳納', font=('Arial', 12), width=15, height=1, command=fun4)
    function4.pack(expand=True)
    function5 = tk.Button(menu1, text='5.信息查詢', font=('Arial', 12), width=15, height=1, command=fun5)
    function5.pack(expand=True)
    menu1.mainloop()

def fun1():
    root1 = tk.Tk()
    root1.title('圖書信息管理')
    root1.geometry('700x400')
    root1_1 =tk.Button(root1,text='圖書信息增加',font=('Arial', 12),width=15, height=1,command=lambda:root1_1_x(root1))
    root1_1.pack(expand=True)
    root1_2 =tk.Button(root1,text='圖書信息刪除',font=('Arial', 12),width=15, height=1,command=lambda:root1_2_x(root1))
    root1_2.pack(expand=True)
    root1_3 =tk.Button(root1,text='圖書信息更新',font=('Arial', 12),width=15, height=1,command=lambda:root1_3_x(root1))
    root1_3.pack(expand=True)
    root1.mainloop()

def root1_1_x(self):
    self.destroy()


    def add_book():
         cursor.execute(("INSERT INTO book_information   VALUES ('" + entry_1.get() + "','" + entry_2.get() + "','" + entry_3.get() + "','" + entry_4.get() + "','" + entry_5.get() + "','" + entry_6.get() + "')"))
         conn.commit()
         conn.rollback()
         tk.messagebox.showinfo(title="提示", message="圖書增加成功")
         root1_1_1.destroy()

    def back():
        root1_1_1.destroy()

    root1_1_1=tk.Tk()
    root1_1_1.title('圖書信息增加')
    root1_1_1.geometry('700x400')
    tk.Label(root1_1_1,text='輸入圖書編號(hào):',).place(x=220,y=50)
    entry_1=tk.Entry(root1_1_1,)
    entry_1.place(x=350, y=50)

    tk.Label(root1_1_1,text='輸入圖書名稱:',).place(x=220,y=80)
    entry_2=tk.Entry(root1_1_1,)
    entry_2.place(x=350, y=80)

    tk.Label(root1_1_1,text='輸入作者名稱:',).place(x=220,y=110)
    entry_3=tk.Entry(root1_1_1,)
    entry_3.place(x=350, y=110)

    tk.Label(root1_1_1,text='輸入圖書類別:',).place(x=220,y=140)
    entry_4=tk.Entry(root1_1_1,)
    entry_4.place(x=350, y=140)

    tk.Label(root1_1_1,text='輸入圖書出版社名稱:',).place(x=220,y=170)
    entry_5=tk.Entry(root1_1_1,)
    entry_5.place(x=350, y=170)

    tk.Label(root1_1_1,text='請(qǐng)輸入圖書總數(shù):',).place(x=220,y=200)
    entry_6=tk.Entry(root1_1_1,)
    entry_6.place(x=350, y=200)

    button1 =tk.Button(root1_1_1,text='確定',command=add_book).place(x=220,y=230)
    button2 =tk.Button(root1_1_1,text='返回',command=back).place(x=350,y=230)

    root1_1_1.mainloop()

def root1_2_x(self):
    self.destroy()
    root1_2_1=tk.Tk()
    root1_2_1.title('圖書信息刪除')
    root1_2_1.geometry('700x400')

    tk.Label(root1_2_1,text='輸入圖書編號(hào):',).place(x=220,y=50)
    entry_1=tk.Entry(root1_2_1,)
    entry_1.place(x=350, y=50)

    tk.Label(root1_2_1,text='輸入圖書名稱:',).place(x=220,y=80)
    entry_2=tk.Entry(root1_2_1,)
    entry_2.place(x=350, y=80)

    def del_book():

        cursor.execute("select * from book_information where book_id='"+ entry_1.get() +"'and book_name = '" + entry_2.get() +"' ")
        a=cursor.fetchall()
        if len(a) !=0:
            cursor.execute(("delete from book_information where book_id='"+ entry_1.get() +"'and book_name = '" + entry_2.get() +"'"))
            conn.commit()
            conn.rollback()

            tk.messagebox.showinfo(title="提示", message="圖書刪除成功")
            root1_2_1.destroy()
        else:
            tk.messagebox.showerror(title='提示', message="未找到此書",)
            root1_2_1.destroy()



    def back():
        root1_2_1.destroy()
    button1 =tk.Button(root1_2_1,text='確定',command=del_book).place(x=220,y=230)
    button2 =tk.Button(root1_2_1,text='返回',command=back).place(x=350,y=230)

def root1_3_x(self):
    self.destroy()
    root1_3_1=tk.Tk()
    root1_3_1.title('圖書信息更新')
    root1_3_1.geometry('700x400')
    root1=tk.Button(root1_3_1,text='以圖書編號(hào)更改',command=lambda:root1_3_x_1(root1_3_1))
    root1.pack(expand=True)
    root2=tk.Button(root1_3_1,text='以圖書名稱更改',command=lambda:root1_3_x_2(root1_3_1))
    root2.pack(expand=True)

    def root1_3_x_1(self):#以圖書編號(hào)更新
        self.destroy()
        root1_3_2 = tk.Toplevel()
        root1_3_2.title('以圖書編號(hào)更改')
        root1_3_2.geometry('700x400')
        lab1=tk.Label(root1_3_2, text='輸入圖書編號(hào):' )
        lab1.place(x=220, y=50)
        entry_a = tk.Entry(root1_3_2)
        entry_a.place(x=350, y=50)
        but1= tk.Button(root1_3_2, text='確定', command=lambda: root1_3_x_1_1(root1_3_2))
        but1.place(x=220,y=80)
        but2 =tk.Button(root1_3_2, text='返回', command=lambda: root1_3_x_1_2(root1_3_2))
        but2.place(x=400,y=80)
        def root1_3_x_1_1(self):#獲取圖書信息并進(jìn)行更改寫入數(shù)據(jù)庫(kù)
            cursor.execute("select * from book_information where book_id='" + entry_a.get() + "' ")
            a = cursor.fetchall()
            conn.commit()
            conn.rollback()

            if len(a) == 0:

                return_value = tk.messagebox.showerror('提示','未找到此書')

                print(type(return_value), return_value)
                root1_3_2.destroy()

            else:#查詢到圖書信息并輸出,用文本框獲取輸入的值

                root1_3_3 = tk.Tk()
                root1_3_3.title('以圖書編號(hào)更改')
                root1_3_3.geometry('700x400')
                tk.Label(root1_3_3, text='查詢到此圖書信息為', ).place(x=150, y=80)
                tk.Label(root1_3_3, text='請(qǐng)?jiān)谙铝休斎肟蛑休斎肽碌膱D書信息', ).place(x=400, y=80)

                tk.Label(root1_3_3, text='圖書編號(hào)', ).place(x=150, y=100)
                tk.Label(root1_3_3, text=a[0][0], ).place(x=250, y=100)
                tk.Label(root1_3_3, text=a[0][0], ).place(x=400, y=100)


                tk.Label(root1_3_3, text='圖書名稱', ).place(x=150, y=120)
                tk.Label(root1_3_3, text=a[0][1], ).place(x=250, y=120)
                entry_2 = tk.Entry(root1_3_3, )
                entry_2.place(x=400, y=120)

                tk.Label(root1_3_3, text='作者名稱', ).place(x=150, y=140)
                tk.Label(root1_3_3, text=a[0][2], ).place(x=250, y=140)
                entry_3 = tk.Entry(root1_3_3, )
                entry_3.place(x=400, y=140)

                tk.Label(root1_3_3, text='圖書類別', ).place(x=150, y=160)
                tk.Label(root1_3_3, text=a[0][3], ).place(x=250, y=160)
                entry_4 = tk.Entry(root1_3_3, )
                entry_4.place(x=400, y=160)

                tk.Label(root1_3_3, text='圖書出版社名稱', ).place(x=150, y=180)
                tk.Label(root1_3_3, text=a[0][4], ).place(x=250, y=180)
                entry_5 = tk.Entry(root1_3_3, )
                entry_5.place(x=400, y=180)

                tk.Label(root1_3_3, text='圖書總數(shù)', ).place(x=150, y=200)
                tk.Label(root1_3_3, text=a[0][5], ).place(x=250, y=200)
                entry_6 = tk.Entry(root1_3_3, )
                entry_6.place(x=400, y=200)

                but3 = tk.Button(root1_3_3, text='確定', command=lambda: root1_3_x_1_2(root1_3_3)).place(x=250,y=250)
                but4 = tk.Button(root1_3_3, text='返回', command=lambda: back(root1_3_3)).place(x=400,y=250)
                def root1_3_x_1_2(self):#確認(rèn)按鈕執(zhí)行數(shù)據(jù)的寫入


                    #cursor.execute("select * from book_information where book_id='1'")
                    cursor.execute("update book_information set book_name ='" + entry_2.get() + "', author='" + entry_3.get() + "',book_category='" + entry_4.get() + "',publisher='" + entry_5.get() + "',book_total='" + entry_6.get() + "' where book_id='" + entry_a.get() + "' ")
                    #c = cursor.fetchall()
                    #print(c[0][1])
                    #cursor.execute("update book_information set book_name='%s',author='%s',book_category='%s',publisher='%s',book_total='%s' where book_id ='1' ") %(entry_2.get(),entry_3.get(),entry_4.get(),entry_5.get(),entry_6.get())
                    conn.commit()
                    conn.rollback()
                    self.destroy()
                    tk.messagebox.showinfo(title="提示", message="圖書更新成功")
                def back(self):
                    self.destroy()


                root1_3_3.mainloop()





        def root1_3_x_1_2(self):#返回按鈕
            self.destroy()

    def root1_3_x_2(self):#以圖書名稱更新圖書信息
        self.destroy()
        root1_3_3 = tk.Toplevel()
        root1_3_3.title('以圖書名稱更改')
        root1_3_3.geometry('700x400')
        lab1 = tk.Label(root1_3_3, text='輸入圖書名稱:')
        lab1.place(x=220, y=50)
        entry_a = tk.Entry(root1_3_3)
        entry_a.place(x=350, y=50)

        print(entry_a.get())

        but1 = tk.Button(root1_3_3, text='確定', command=lambda: root1_3_x_1_2(root1_3_3))
        but1.place(x=220, y=80)
        but2 = tk.Button(root1_3_3, text='返回', command=lambda: back(root1_3_3))
        but2.place(x=400, y=80)

        def back(self):
            self.destroy()
        def root1_3_x_1_2(self):#獲取讀者信息并進(jìn)行更改寫入數(shù)據(jù)庫(kù)
            cursor.execute("select * from book_information where book_name='" + entry_a.get() + "' ")
            a = cursor.fetchall()
            conn.commit()
            conn.rollback()

            if len(a) == 0:

                return_value = tk.messagebox.showerror('提示','未找到此書')

                print(type(return_value), return_value)
                root1_3_3.destroy()

            else:#查詢到圖書信息并輸出,用文本框獲取輸入的值

                root1_3_4 = tk.Tk()
                root1_3_4.title('以圖書名稱更改')
                root1_3_4.geometry('700x400')
                tk.Label(root1_3_4, text='查詢到此圖書信息為', ).place(x=150, y=80)
                tk.Label(root1_3_4, text='請(qǐng)?jiān)谙铝休斎肟蛑休斎肽碌膱D書信息', ).place(x=400, y=80)

                tk.Label(root1_3_4, text='圖書名稱', ).place(x=150, y=100)
                tk.Label(root1_3_4, text=a[0][0], ).place(x=250, y=100)
                tk.Label(root1_3_4, text=a[0][0], ).place(x=400, y=100)


                tk.Label(root1_3_4, text='圖書編號(hào)', ).place(x=150, y=120)
                tk.Label(root1_3_4, text=a[0][1], ).place(x=250, y=120)
                entry_2 = tk.Entry(root1_3_4, )
                entry_2.place(x=400, y=120)

                tk.Label(root1_3_4, text='作者名稱', ).place(x=150, y=140)
                tk.Label(root1_3_4, text=a[0][2], ).place(x=250, y=140)
                entry_3 = tk.Entry(root1_3_4, )
                entry_3.place(x=400, y=140)

                tk.Label(root1_3_4, text='圖書類別', ).place(x=150, y=160)
                tk.Label(root1_3_4, text=a[0][3], ).place(x=250, y=160)
                entry_4 = tk.Entry(root1_3_4, )
                entry_4.place(x=400, y=160)

                tk.Label(root1_3_4, text='圖書出版社名稱', ).place(x=150, y=180)
                tk.Label(root1_3_4, text=a[0][4], ).place(x=250, y=180)
                entry_5 = tk.Entry(root1_3_4, )
                entry_5.place(x=400, y=180)

                tk.Label(root1_3_4, text='圖書總數(shù)', ).place(x=150, y=200)
                tk.Label(root1_3_4, text=a[0][5], ).place(x=250, y=200)
                entry_6 = tk.Entry(root1_3_4, )
                entry_6.place(x=400, y=200)

                but3 = tk.Button(root1_3_4, text='確定', command=lambda: root1_3_x_1_3(root1_3_4)).place(x=250,y=250)
                but4 = tk.Button(root1_3_4, text='返回', command=lambda: back(root1_3_4)).place(x=400,y=250)
                def root1_3_x_1_3(self):#確認(rèn)按鈕執(zhí)行數(shù)據(jù)的寫入


                    #cursor.execute("select * from book_information where book_id='1'")
                    cursor.execute("update book_information set book_id ='" + entry_2.get() + "', author='" + entry_3.get() + "',book_category='" + entry_4.get() + "',publisher='" + entry_5.get() + "',book_total='" + entry_6.get() + "' where book_name='" + entry_a.get() + "' ")
                    #c = cursor.fetchall()
                    #print(c[0][1])
                    #cursor.execute("update book_information set book_name='%s',author='%s',book_category='%s',publisher='%s',book_total='%s' where book_id ='1' ") %(entry_2.get(),entry_3.get(),entry_4.get(),entry_5.get(),entry_6.get())
                    conn.commit()
                    conn.rollback()
                    self.destroy()
                    tk.messagebox.showinfo(title="提示", message="圖書更新成功")
                    root1_3_3.destroy()



                root1_3_4.mainloop()

def fun2():
    root2 = tk.Tk()
    root2.title('讀者信息管理')
    root2.geometry('700x400')
    root2_1 =tk.Button(root2,text='讀者信息增加',font=('Arial', 12),width=15, height=1,command=lambda:root2_1_x(root2))
    root2_1.pack(expand=True)
    root2_2 =tk.Button(root2,text='讀者信息刪除',font=('Arial', 12),width=15, height=1,command=lambda:root2_2_x(root2))
    root2_2.pack(expand=True)
    root2_3 =tk.Button(root2,text='讀者信息更新',font=('Arial', 12),width=15, height=1,command=lambda:root2_3_x(root2))
    root2_3.pack(expand=True)

def root2_1_x(self):#增加讀者信息界面
    self.destroy()


    def add_reader():
         cursor.execute(("INSERT INTO reader_information   VALUES ('" + entry_1.get() + "','" + entry_2.get() + "','" + entry_3.get() + "','" + entry_4.get() + "','" + entry_5.get() + "')"))
         conn.commit()
         conn.rollback()
         tk.messagebox.showinfo(title="提示", message="讀者增加成功")
         root2_1_1.destroy()

    def back():
        root2_1_1.destroy()

    root2_1_1=tk.Tk()
    root2_1_1.title('讀者信息增加')
    root2_1_1.geometry('700x400')
    tk.Label(root2_1_1,text='輸入讀者編號(hào):',).place(x=220,y=50)
    entry_1=tk.Entry(root2_1_1,)
    entry_1.place(x=350, y=50)

    tk.Label(root2_1_1,text='輸入讀者名稱:',).place(x=220,y=80)
    entry_2=tk.Entry(root2_1_1,)
    entry_2.place(x=350, y=80)

    tk.Label(root2_1_1,text='輸入讀者班級(jí):',).place(x=220,y=110)
    entry_3=tk.Entry(root2_1_1,)
    entry_3.place(x=350, y=110)

    tk.Label(root2_1_1,text='輸入讀者類別:',).place(x=220,y=140)
    entry_4=tk.Entry(root2_1_1,)
    entry_4.place(x=350, y=140)

    tk.Label(root2_1_1,text='輸入可借閱最大書籍?dāng)?shù):',).place(x=220,y=170)
    entry_5=tk.Entry(root2_1_1,)
    entry_5.place(x=350, y=170)






    button1 =tk.Button(root2_1_1,text='確定',command=add_reader).place(x=220,y=230)
    button2 =tk.Button(root2_1_1,text='返回',command=back).place(x=350,y=230)

    root2_1_1.mainloop()

def root2_2_x(self):#刪除讀者信息界面
    self.destroy()
    root2_2_1=tk.Tk()
    root2_2_1.title('讀者信息刪除')
    root2_2_1.geometry('700x400')

    tk.Label(root2_2_1,text='輸入讀者編號(hào):',).place(x=220,y=50)
    entry_1=tk.Entry(root2_2_1,)
    entry_1.place(x=350, y=50)

    tk.Label(root2_2_1,text='輸入讀者名稱:',).place(x=220,y=80)
    entry_2=tk.Entry(root2_2_1,)
    entry_2.place(x=350, y=80)

    def del_reader():

        cursor.execute("select * from reader_information where reader_id='"+ entry_1.get() +"'and reader_name = '" + entry_2.get() +"' ")
        a=cursor.fetchall()
        if len(a) !=0:
            cursor.execute(("delete from reader_information where reader_id='"+ entry_1.get() +"'and reader_name = '" + entry_2.get() +"'"))
            conn.commit()
            conn.rollback()

            tk.messagebox.showinfo(title="提示", message="讀者刪除成功")
            root2_2_1.destroy()
        else:
            tk.messagebox.showerror(title='提示', message="未找到此讀者")
            root2_2_1.destroy()



    def back():
        root2_2_1.destroy()
    button1 =tk.Button(root2_2_1,text='確定',command=del_reader).place(x=220,y=230)
    button2 =tk.Button(root2_2_1,text='返回',command=back).place(x=350,y=230)

def root2_3_x(self):#更新讀者信息界面
    self.destroy()
    root2_3_1 = tk.Tk()
    root2_3_1.title('讀者信息更新')
    root2_3_1.geometry('700x400')
    root1 = tk.Button(root2_3_1, text='以讀者編號(hào)更改', command=lambda: root2_3_x_1(root2_3_1))
    root1.pack(expand=True)
    root2 = tk.Button(root2_3_1, text='以讀者名稱更改', command=lambda: root2_3_x_2(root2_3_1))
    root2.pack(expand=True)

    def root2_3_x_1(self):  # 以讀者編號(hào)更新
        self.destroy()
        root2_3_2 = tk.Toplevel()
        root2_3_2.title('以讀者編號(hào)更改')
        root2_3_2.geometry('700x400')
        lab1 = tk.Label(root2_3_2, text='輸入讀者編號(hào):')

        lab1.place(x=220, y=50)
        entry_a = tk.Entry(root2_3_2)
        entry_a.place(x=350, y=50)
        but1 = tk.Button(root2_3_2, text='確定', command=lambda: root2_3_x_1_1(root2_3_2))
        but1.place(x=220, y=80)
        but2 = tk.Button(root2_3_2, text='返回', command=lambda: root2_3_x_1_2(root2_3_2))
        but2.place(x=400, y=80)

        def root2_3_x_1_1(self):  # 獲取讀者信息并進(jìn)行更改寫入數(shù)據(jù)庫(kù)
            cursor.execute("select * from reader_information where reader_id='" + entry_a.get() + "' ")
            a = cursor.fetchall()
            conn.commit()
            conn.rollback()
            self.destroy()

            if len(a) == 0:

                return_value = tk.messagebox.showerror('提示', '未找到讀者')

                print(type(return_value), return_value)
                root2_3_2.destroy()

            else:  # 查詢到讀者信息并輸出,用文本框獲取輸入的值

                root2_3_3 = tk.Tk()
                root2_3_3.title('以讀者編號(hào)更改')
                root2_3_3.geometry('700x400')
                tk.Label(root2_3_3, text='查詢到此讀者信息為', ).place(x=150, y=80)
                tk.Label(root2_3_3, text='請(qǐng)?jiān)谙铝休斎肟蛑休斎肽碌淖x者信息', ).place(x=400, y=80)

                tk.Label(root2_3_3, text='讀者編號(hào)', ).place(x=150, y=100)
                tk.Label(root2_3_3, text=a[0][0], ).place(x=250, y=100)
                tk.Label(root2_3_3, text=a[0][0], ).place(x=400, y=100)

                tk.Label(root2_3_3, text='讀者名稱', ).place(x=150, y=120)
                tk.Label(root2_3_3, text=a[0][1], ).place(x=250, y=120)
                entry_2 = tk.Entry(root2_3_3, )
                entry_2.place(x=400, y=120)

                tk.Label(root2_3_3, text='讀者班級(jí)', ).place(x=150, y=140)
                tk.Label(root2_3_3, text=a[0][2], ).place(x=250, y=140)
                entry_3 = tk.Entry(root2_3_3, )
                entry_3.place(x=400, y=140)

                tk.Label(root2_3_3, text='讀者類別', ).place(x=150, y=160)
                tk.Label(root2_3_3, text=a[0][3], ).place(x=250, y=160)
                entry_4 = tk.Entry(root2_3_3, )
                entry_4.place(x=400, y=160)

                tk.Label(root2_3_3, text='讀者最大借閱數(shù)', ).place(x=150, y=180)
                tk.Label(root2_3_3, text=a[0][4], ).place(x=250, y=180)
                entry_5 = tk.Entry(root2_3_3, )
                entry_5.place(x=400, y=180)


                but3 = tk.Button(root2_3_3, text='確定', command=lambda: root2_3_x_1_2(root2_3_3)).place(x=250, y=250)
                but4 = tk.Button(root2_3_3, text='返回', command=lambda: back(root2_3_3)).place(x=400, y=250)

                def root2_3_x_1_2(self):  # 確認(rèn)按鈕執(zhí)行數(shù)據(jù)的寫入

                    # cursor.execute("select * from book_information where book_id='1'")
                    cursor.execute("update reader_information set reader_name ='" + entry_2.get() + "', reader_class='" + entry_3.get() + "',reader_category='" + entry_4.get() + "',reader_borrowednumber='" + entry_5.get() + "' where reader_id='" + entry_a.get() + "' ")
                    # c = cursor.fetchall()
                    # print(c[0][1])
                    # cursor.execute("update book_information set book_name='%s',author='%s',book_category='%s',publisher='%s',book_total='%s' where book_id ='1' ") %(entry_2.get(),entry_3.get(),entry_4.get(),entry_5.get(),entry_6.get())
                    conn.commit()
                    conn.rollback()
                    #self.destroy()
                    tk.messagebox.showinfo(title="提示", message="讀者信息更新成功")

                def back(self):
                    self.destroy()

                root2_3_3.mainloop()

        def root2_3_x_1_2(self):  # 返回按鈕
            self.destroy()

    def root2_3_x_2(self):  # 以讀者名稱更新圖書信息
        self.destroy()
        root2_3_3 = tk.Toplevel()
        root2_3_3.title('以讀者名稱更改')
        root2_3_3.geometry('700x400')
        lab1 = tk.Label(root2_3_3, text='輸入讀者名稱:')
        lab1.place(x=220, y=50)
        entry_a = tk.Entry(root2_3_3)
        entry_a.place(x=350, y=50)

        but1 = tk.Button(root2_3_3, text='確定', command=lambda: root2_3_x_1_2(root2_3_3))
        but1.place(x=220, y=80)
        but2 = tk.Button(root2_3_3, text='返回', command=lambda: back(root2_3_3))
        but2.place(x=400, y=80)

        def back(self):
            self.destroy()

        def root2_3_x_1_2(self):  # 獲取讀者信息并進(jìn)行更改寫入數(shù)據(jù)庫(kù)
            cursor.execute("select * from reader_information where reader_name='" + entry_a.get() + "' ")
            a = cursor.fetchall()
            conn.commit()
            conn.rollback()

            if len(a) == 0:

                return_value = tk.messagebox.showerror('提示', '未找到此讀者')

                print(type(return_value), return_value)
                root2_3_3.destroy()

            else:  # 查詢到圖書信息并輸出,用文本框獲取輸入的值

                root2_3_4 = tk.Tk()
                root2_3_4.title('以讀者名稱更改')
                root2_3_4.geometry('700x400')
                tk.Label(root2_3_4, text='查詢到此讀者信息為', ).place(x=150, y=80)
                tk.Label(root2_3_4, text='請(qǐng)?jiān)谙铝休斎肟蛑休斎肽碌淖x者信息', ).place(x=400, y=80)

                tk.Label(root2_3_4, text='讀者姓名', ).place(x=150, y=100)
                tk.Label(root2_3_4, text=a[0][0], ).place(x=250, y=100)
                tk.Label(root2_3_4, text=a[0][0], ).place(x=400, y=100)

                tk.Label(root2_3_4, text='讀者編號(hào)', ).place(x=150, y=120)
                tk.Label(root2_3_4, text=a[0][1], ).place(x=250, y=120)
                entry_2 = tk.Entry(root2_3_4, )
                entry_2.place(x=400, y=120)

                tk.Label(root2_3_4, text='讀者班級(jí)', ).place(x=150, y=140)
                tk.Label(root2_3_4, text=a[0][2], ).place(x=250, y=140)
                entry_3 = tk.Entry(root2_3_4, )
                entry_3.place(x=400, y=140)

                tk.Label(root2_3_4, text='讀者類別', ).place(x=150, y=160)
                tk.Label(root2_3_4, text=a[0][3], ).place(x=250, y=160)
                entry_4 = tk.Entry(root2_3_4, )
                entry_4.place(x=400, y=160)

                tk.Label(root2_3_4, text='讀者最大借閱數(shù)', ).place(x=150, y=180)
                tk.Label(root2_3_4, text=a[0][4], ).place(x=250, y=180)
                entry_5 = tk.Entry(root2_3_4, )
                entry_5.place(x=400, y=180)


                but3 = tk.Button(root2_3_4, text='確定', command=lambda: root2_3_x_1_3(root2_3_4)).place(x=250, y=250)
                but4 = tk.Button(root2_3_4, text='返回', command=lambda: back(root2_3_4)).place(x=400, y=250)

                def root2_3_x_1_3(self):  # 確認(rèn)按鈕執(zhí)行數(shù)據(jù)的寫入reader_borrowednumber

                    # cursor.execute("select * from book_information where book_id='1'")
                    cursor.execute(
                        "update reader_information set reader_id ='" + entry_2.get() + "', reader_class='" + entry_3.get() + "',reader_category='" + entry_4.get() + "',reader_borrowednumber='" + entry_5.get() + "' where reader_name='" + entry_a.get() + "' ")
                    # c = cursor.fetchall()
                    # print(c[0][1])
                    # cursor.execute("update book_information set book_name='%s',author='%s',book_category='%s',publisher='%s',book_total='%s' where book_id ='1' ") %(entry_2.get(),entry_3.get(),entry_4.get(),entry_5.get(),entry_6.get())
                    conn.commit()
                    conn.rollback()
                    self.destroy()
                    tk.messagebox.showinfo(title="提示", message="讀者更新成功")
                    root2_3_3.destroy()

                root2_3_4.mainloop()

def fun3():
    root3 = tk.Tk()
    root3.title('圖書借閱管理')
    root3.geometry('700x400')
    root3_1 =tk.Button(root3,text='圖書借閱',font=('Arial', 12),width=15, height=1,command=lambda:root3_1_x(root3))
    root3_1.pack(expand=True)
    root3_2 =tk.Button(root3,text='圖書歸還',font=('Arial', 12),width=15, height=1,command=lambda:root3_2_x(root3))
    root3_2.pack(expand=True)
    root3.mainloop()

def root3_1_x(self):#借書功能
    self.destroy()
    root3_1_1=tk.Tk()
    root3_1_1.title('圖書借閱')
    root3_1_1.geometry('700x400')

    def borrow_book():
        cursor.execute("insert into reader_borrow values ('%s','%s','%s')" % (entry_1.get(),entry_2.get(),entry_3.get()))
        conn.commit()
        conn.rollback()
        tk.messagebox.showinfo(title="提示", message="圖書借閱成功")
        root3_1_1.destroy()
    def back():
        root3_1_1.destroy()
        return fun3()



    tk.Label(root3_1_1,text='輸入讀者id:',).place(x=220,y=50)
    entry_1=tk.Entry(root3_1_1,)
    entry_1.place(x=350, y=50)

    tk.Label(root3_1_1,text='輸入所借閱書名:',).place(x=220,y=100)
    entry_2=tk.Entry(root3_1_1,)
    entry_2.place(x=350, y=100)

    tk.Label(root3_1_1,text='輸入借閱日期:',).place(x=220,y=150)
    entry_3=tk.Entry(root3_1_1,)
    entry_3.insert(0,day_now)
    entry_3.place(x=350, y=150)


    button1 =tk.Button(root3_1_1,text='確定',command=borrow_book).place(x=220,y=230)
    button2 =tk.Button(root3_1_1,text='返回',command=back).place(x=350,y=230)

    root3_1_1.mainloop()

def root3_2_x(self):#還書功能
    self.destroy()
    root3_2_1=tk.Tk()
    root3_2_1.title('圖書歸還')
    root3_2_1.geometry('700x400')

    def back_book():
        cursor.execute("insert into reader_back values ('%s','%s','%s')" % (entry_1.get(),entry_2.get(),entry_3.get()))
        conn.commit()
        conn.rollback()
        tk.messagebox.showinfo(title="提示", message="圖書歸還成功")
        root3_2_1.destroy()
    def back():
        root3_2_1.destroy()
        return fun3()



    tk.Label(root3_2_1,text='輸入讀者id:',).place(x=220,y=50)
    entry_1=tk.Entry(root3_2_1,)
    entry_1.place(x=350, y=50)

    tk.Label(root3_2_1,text='輸入所歸還書名:',).place(x=220,y=100)
    entry_2=tk.Entry(root3_2_1,)
    entry_2.place(x=350, y=100)

    tk.Label(root3_2_1,text='輸入歸還日期:',).place(x=220,y=150)
    entry_3=tk.Entry(root3_2_1,)
    entry_3.insert(0,day_now)
    entry_3.place(x=350, y=150)


    button1 =tk.Button(root3_2_1,text='確定',command=back_book).place(x=220,y=230)
    button2 =tk.Button(root3_2_1,text='返回',command=back).place(x=350,y=230)

    root3_2_1.mainloop()

def fun4():
    root4_1=tk.Toplevel()
    root4_1.title('罰款查詢')
    root4_1.geometry('700x400')

    def select():

        def box1():
            cursor.execute("delete from reader_payment where reader_id = '"+entry_1.get()+"'")
            conn.commit()
            conn.rollback()
            tk.messagebox.showinfo(title="提示", message="繳納成功")
            root4_1.destroy()
            root4_1_1.destroy()


        def back1(self):
            self.destroy()
            cursor.execute("delete from reader_payment where reader_id = '"+entry_1.get()+"'")
            conn.commit()
            conn.rollback()
            #return fun4()

        cursor.execute("exec proc_pay @id='"+ entry_1.get() +"'")
        a = cursor.fetchall()
        conn.commit()
        conn.rollback()
        if len(a)!=0:
            sum = 0
            for i in range(len(a)):
                x=a[i][2]
                y=a[i][3]
                x1 =x.strftime("%Y-%m-%d")
                y1=  y.strftime("%Y-%m-%d")
                q=x1.split('-',2)[0]
                w = x1.split('-', 2)[1]
                e = x1.split('-', 2)[2]
                r=y1.split('-',2)[0]
                t = y1.split('-', 2)[1]
                u = y1.split('-', 2)[2]
                days=365*(int(q)-int(r))+31*(int(w)-int(t))+int(e)-int(u)
                sum = sum + (1.5 * days)
                cursor.execute("insert into reader_payment values ('%s','%d')" % (entry_1.get(),sum))
                conn.commit()
                conn.rollback()



            root4_1_1=tk.Tk()
            root4_1_1.title('罰款查詢')
            root4_1_1.geometry('700x400')
            tk.Label(root4_1_1, text="{}待繳納罰款:".format(entry_2.get()) ).place(x=160, y=50)
            tk.Label(root4_1_1, text="{}元".format(sum)).place(x=300, y=50)


            button1 = tk.Button(root4_1_1, text='確定繳納', command=box1).place(x=160, y=230)
            button2 = tk.Button(root4_1_1, text='返回', command=lambda :back1(root4_1_1)).place(x=300, y=230)

        else:
            tk.messagebox.showinfo(title="提示", message="未查詢到此人有待繳罰款")

    def back():
        root4_1.destroy()


    tk.Label(root4_1,text='輸入讀者id:',).place(x=220,y=50)
    entry_1=tk.Entry(root4_1,)
    entry_1.place(x=350, y=50)

    tk.Label(root4_1,text='輸入讀者姓名:',).place(x=220,y=100)
    entry_2=tk.Entry(root4_1,)
    entry_2.place(x=350, y=100)

    button1 =tk.Button(root4_1,text='確定',command=select).place(x=220,y=230)
    button2 =tk.Button(root4_1,text='返回',command=back).place(x=350,y=230)

    root4_1.mainloop()

def fun5():

    root5 = tk.Tk()
    root5.title('信息查詢')
    root5.geometry('700x400')
    function1 = tk.Button(root5, text='1.圖書信息查詢', font=('Arial', 12), width=15, height=1, command=lambda :root5_1(root5),)
    function1.pack(expand=True)
    function2 = tk.Button(root5, text='2.讀者信息查詢', font=('Arial', 12), width=15, height=1, command=lambda:root5_2(root5))
    function2.pack(expand=True)

def root5_1(self):
    self.destroy()
    def back(self):
        self.destroy()


    def select_book_1():
        root5_1_1.update()
        root5_1_1.destroy()
        sql="select * from book_select"
        cursor.execute(sql)
        a=cursor.fetchall()
        print("--------------------作品信息--------------------")
        print('圖書編號(hào): 圖書名稱:  圖書總數(shù):  在館冊(cè)數(shù): ')
        root5_1_1_1 = tk.Tk()
        root5_1_1_1.title('圖書信息查詢')
        root5_1_1_1.geometry('700x400')
        root5_1_1_1.configure()
        l = tk.Label(root5_1_1_1, text='圖書信息如下')
        l.pack()
        l1 = tk.Label(root5_1_1_1, text='圖書編號(hào):')
        l1.place(x=20, y=40, width=90, height=20)
        l2 = tk.Label(root5_1_1_1, text='圖書名稱:')
        l2.place(x=135, y=40, width=90, height=20)
        l3 = tk.Label(root5_1_1_1, text='圖書總數(shù):')
        l3.place(x=270, y=40, width=90, height=20)
        l4 = tk.Label(root5_1_1_1, text='在館冊(cè)數(shù):')
        l4.place(x=405, y=40, width=90, height=20)
        j=1
        t=0
        ex=0
        for i in range(len(a)):
            ex=ex+1
            t=t+1
            if t%5==0 or t==len(a):
                break

        for i in range(t-ex,t):
            y=j*45+40
            l11 = tk.Label(root5_1_1_1, text=('{}').format(a[i][0]))
            l11.place(x=20, y=y, width=90, height=20)
            l22 = tk.Label(root5_1_1_1, text=('{}').format(a[i][1]))
            l22.place(x=135, y=y, width=90, height=20)
            l33 = tk.Label(root5_1_1_1, text=('{}').format(a[i][2]))
            l33.place(x=270, y=y, width=90, height=20)
            l44 = tk.Label(root5_1_1_1,text=('{}').format(a[i][3]))
            l44.place(x=405, y=y, width=90, height=20)
            j=j+1
        if t!=len(a):
            buttonOk = tk.Button(root5_1_1_1, font=('Arial', 11), text='點(diǎn)擊返回主頁(yè)面',
                                      command=lambda: back(root5_1_1_1))
            buttonOk.place(x=250, y=350, width=160, height=40)
            buttonOk = tk.Button(root5_1_1_1, font=('Arial', 11), text='下一頁(yè)',
                                      command=lambda: back(root5_1_1_1,'a3b1','we'))
            buttonOk.place(x=300, y=300, width=60, height=40)
        else:
            t=0
            buttonOk = tk.Button(root5_1_1_1,  font=('Arial', 11), text='已是最后一頁(yè),點(diǎn)擊返回主頁(yè)面',
                                          command=lambda: back(root5_1_1_1))
            buttonOk.place(x=180, y=300, width=250, height=40)
        root5_1_1_1.mainloop()


    root5_1_1 = tk.Tk()
    root5_1_1.title('圖書信息查詢')
    root5_1_1.geometry('700x400')
    select_book_1()
    root5_1_1.mainloop()

def root5_2(self):
    self.destroy()
    def back(self):
        self.destroy()


    def select_book_1():
        root5_1_2.update()
        root5_1_2.destroy()
        sql="select * from reader_information"
        cursor.execute(sql)
        a=cursor.fetchall()
        print("--------------------作品信息--------------------")
        print('讀者編號(hào): 讀者名稱:  讀者班級(jí):  讀者類別:  最大借閱數(shù): ')
        root5_1_2_1 = tk.Tk()
        root5_1_2_1.title('讀者信息查詢')
        root5_1_2_1.geometry('700x400')
        root5_1_2_1.configure()
        l = tk.Label(root5_1_2_1, text='讀者信息如下')
        l.pack()
        l1 = tk.Label(root5_1_2_1, text='讀者編號(hào):')
        l1.place(x=20, y=40, width=90, height=20)
        l2 = tk.Label(root5_1_2_1, text='讀者名稱:')
        l2.place(x=135, y=40, width=90, height=20)
        l3 = tk.Label(root5_1_2_1, text='讀者班級(jí):')
        l3.place(x=270, y=40, width=90, height=20)
        l4 = tk.Label(root5_1_2_1, text='讀者類別:')
        l4.place(x=405, y=40, width=90, height=20)
        l5 = tk.Label(root5_1_2_1, text='最大借閱數(shù):')
        l5.place(x=540, y=40, width=90, height=20)
        j=1
        t=0
        ex=0
        for i in range(len(a)):
            ex=ex+1
            t=t+1
            if t%5==0 or t==len(a):
                break

        for i in range(t-ex,t):
            y=j*45+40
            l11 = tk.Label(root5_1_2_1, text=('{}').format(a[i][0]))
            l11.place(x=20, y=y, width=90, height=20)
            l22 = tk.Label(root5_1_2_1, text=('{}').format(a[i][1]))
            l22.place(x=135, y=y, width=90, height=20)
            l33 = tk.Label(root5_1_2_1, text=('{}').format(a[i][2]))
            l33.place(x=270, y=y, width=90, height=20)
            l44 = tk.Label(root5_1_2_1,text=('{}').format(a[i][3]))
            l44.place(x=405, y=y, width=90, height=20)
            l55 = tk.Label(root5_1_2_1,text=('{}').format(a[i][4]))
            l55.place(x=540, y=y, width=90, height=20)
            j=j+1
        if t!=len(a):
            buttonOk = tk.Button(root5_1_2_1, font=('Arial', 11), text='點(diǎn)擊返回主頁(yè)面',
                                      command=lambda: back(root5_1_2_1))
            buttonOk.place(x=250, y=350, width=160, height=40)
            buttonOk = tk.Button(root5_1_2_1, font=('Arial', 11), text='下一頁(yè)',
                                      command=lambda: back(root5_1_2_1,'a3b1','we'))
            buttonOk.place(x=300, y=300, width=60, height=40)
        else:
            t=0
            buttonOk = tk.Button(root5_1_2_1,  font=('Arial', 11), text='已是最后一頁(yè),點(diǎn)擊返回主頁(yè)面',
                                          command=lambda: back(root5_1_2_1))
            buttonOk.place(x=180, y=300, width=250, height=40)
        root5_1_2_1.mainloop()


    root5_1_2 = tk.Tk()
    root5_1_2.title('圖書信息查詢')
    root5_1_2.geometry('700x400')
    select_book_1()
    root5_1_2.mainloop()

now=datetime.datetime.now()
day_year=now.year
day_month=now.month
day_day=now.day
day_now=('{}/{}/{}').format(day_year,day_month,day_day)

window = tk.Tk()
window.title('歡迎使用圖書管理系統(tǒng)')
window.geometry('450x300')

# user information
tk.Label(window, text='User name: ').place(x=50, y=150)
tk.Label(window, text='Password: ').place(x=50, y=190)

var_usr_name = tk.StringVar()
entry_usr_name = tk.Entry(window, textvariable=var_usr_name)
entry_usr_name.place(x=160, y=150)
var_usr_pwd = tk.StringVar()
entry_usr_pwd = tk.Entry(window, textvariable=var_usr_pwd, show='*')
entry_usr_pwd.place(x=160, y=190)

def usr_login():
    usr_name = var_usr_name.get()
    usr_pwd = var_usr_pwd.get()
    try:
        with open('usrs_info.pickle', 'rb') as usr_file:
            usrs_info = pickle.load(usr_file)
            print(usrs_info)
    except FileNotFoundError:
        with open('usrs_info.pickle', 'wb') as usr_file:
            usrs_info = {'admin': 'admin'}
            pickle.dump(usrs_info, usr_file)
    if usr_name in usrs_info:
        if usr_pwd == usrs_info[usr_name]:
            window.destroy()
            return menu()
            cursor.close()
        else:
            tk.messagebox.showerror(message='Error, your password is wrong, try again.')
    else:
        is_sign_up = tk.messagebox.askyesno('Error, your a is wrong, try again.')

def usr_sign_up():
    #確認(rèn)注冊(cè)函數(shù),以便后面調(diào)用
    def signyes():
        username = sign_up_name.get()
        password = sign_up_pwd.get()
        confirmpass = sign_up_conf.get()
        try:
            with open('usrs_info.pickle','rb') as usr_file:
                exist_usr_info = pickle.load(usr_file)
        except FileNotFoundError:
            exist_usr_info = {}
        if username in exist_usr_info:
            tk.messagebox.showerror(message='用戶已存在!')
        elif username == '' and password == '':
            tk.messagebox.showerror(message='用戶名和密碼不能為空!')
        elif password != confirmpass:
            tk.messagebox.showerror(message='密碼前后不一致!')
        else:
            exist_usr_info[username] = password
            with open('usrs_info.pickle', 'wb') as usr_file:
                pickle.dump(exist_usr_info, usr_file)
                tk.messagebox.showinfo(message='注冊(cè)成功!')
                window_sign.destroy()  #存完了就銷毀頁(yè)面

    #新建注冊(cè)窗口
    window_sign = tk.Toplevel(window)
    window_sign.geometry('450x300')
    window_sign.title('sign up')
    #注冊(cè)組件的文字部分
    tk.Label(window_sign, text='username: ').place(x=50, y=130)
    tk.Label(window_sign, text='password: ').place(x=50, y=160)
    tk.Label(window_sign, text='confirmpass: ').place(x=50, y=190)
    # 注冊(cè)組件框部分
    sign_up_name = tk.StringVar()
    sign_up_pwd = tk.StringVar()
    sign_up_conf = tk.StringVar()
    enter_sign_up_name = tk.Entry(window_sign, textvariable=sign_up_name)
    enter_sign_up_name.place(x=160, y=130)
    enter_sign_up_pwd = tk.Entry(window_sign, textvariable=sign_up_pwd, show='*')
    enter_sign_up_pwd.place(x=160, y=160)
    enter_sign_up_conf = tk.Entry(window_sign, textvariable=sign_up_conf, show='*')
    enter_sign_up_conf.place(x=160, y=190)
    #確認(rèn)注冊(cè)按鈕
    btn_confirm = tk.Button(window_sign, text='確定', command=signyes)
    btn_confirm.place(x=180, y=230)

# login and sign up button
btn_login = tk.Button(window, text='Login', command=usr_login) #這里command是方法
btn_login.place(x=170, y=230)
btn_sign_up = tk.Button(window, text='Sign up', command=usr_sign_up)
btn_sign_up.place(x=270, y=230)

window.mainloop()

這之中登錄界面子程序是在網(wǎng)上看到有作者發(fā)的就拿來(lái)用了,如果不能發(fā)請(qǐng)聯(lián)系我刪除。

輸出作者信息和圖書信息使用到的類計(jì)數(shù)器是改的朋友的代碼,會(huì)有一些沒(méi)有出現(xiàn)在本程序里面的參數(shù)導(dǎo)致影響閱讀體驗(yàn),但是本著代碼能跑就不改的原則我沒(méi)有進(jìn)行更改,希望大家原諒文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-511077.html

到了這里,關(guān)于學(xué)校圖書借閱管理系統(tǒng)(python + sql serve)數(shù)據(jù)庫(kù)大作業(yè)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來(lái)自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • 圖書借閱管理系統(tǒng)

    圖書借閱管理系統(tǒng)

    1、系統(tǒng)概述 圖書借閱管理系統(tǒng)由管理員系統(tǒng)和用戶系統(tǒng)兩個(gè)子系統(tǒng)構(gòu)成。用戶運(yùn)行程序后可按程序說(shuō)明進(jìn)入子系統(tǒng),輸入“1”進(jìn)入管理員系統(tǒng),輸入“2”進(jìn)入用戶系統(tǒng)。圖書信息和讀者信息均用文件存儲(chǔ)。?? 管理員系統(tǒng): 新增圖書:管理員可輸入圖書的類別、書號(hào)、書名

    2024年02月05日
    瀏覽(22)
  • 云借閱-圖書管理系統(tǒng)

    云借閱-圖書管理系統(tǒng)

    程序設(shè)計(jì)邏輯簡(jiǎn)單,適合觀摩學(xué)習(xí)使用。 云借閱圖書管理系統(tǒng)主要實(shí)現(xiàn)了兩大功能模塊:用戶登錄模塊和圖書管理模塊,用戶登錄模塊主要用于實(shí)現(xiàn)用戶的登錄與注銷;圖書管理模塊主要用于管理圖書,如新書推薦、圖書借閱等。 1.開(kāi)發(fā)技術(shù): 后端:SSM(Spring、SpringMVC、Mybatis

    2024年02月13日
    瀏覽(22)
  • 云借閱圖書管理系統(tǒng)

    云借閱圖書管理系統(tǒng)

    ? ? ? ? ?基于SSM(Spring + Spring MVC + Mybatis)框架開(kāi)發(fā)的一個(gè)較為簡(jiǎn)單的云借閱圖書管理系統(tǒng),雖然比較簡(jiǎn)單,但是耐心的做完會(huì)對(duì)? Spring框架 和 Spring MVC框架 以及 Mybatis 框架? 這三個(gè)框架的整合開(kāi)發(fā)有一個(gè)較好的理解 。 下面我就來(lái)簡(jiǎn)單的研究一下代碼,全部的代碼文件,我

    2024年02月06日
    瀏覽(22)
  • Java web圖書管理系統(tǒng)、在線圖書借閱管理系統(tǒng)(帶文檔)

    Java web圖書管理系統(tǒng)、在線圖書借閱管理系統(tǒng)(帶文檔)

    ?大家好,我是DeBug,很高興你能來(lái)閱讀!作為一名熱愛(ài)編程的程序員,我希望通過(guò)這些教學(xué)筆記與大家分享我的編程經(jīng)驗(yàn)和知識(shí)。在這里,我將會(huì)結(jié)合實(shí)際項(xiàng)目經(jīng)驗(yàn),分享編程技巧、最佳實(shí)踐以及解決問(wèn)題的方法。無(wú)論你是初學(xué)者還是有一定經(jīng)驗(yàn)的程序員,我都希望能夠?yàn)槟?/p>

    2024年01月23日
    瀏覽(25)
  • 圖書借閱管理系統(tǒng)——C++版

    圖書借閱管理系統(tǒng)——C++版

    文章目錄 前言 一、總體結(jié)構(gòu) 二、詳細(xì)代碼 圖書借閱管理系統(tǒng)的總體功能要求 : 圖書借閱管理系統(tǒng)的總體目標(biāo):在Visual Studio 2022的開(kāi)發(fā)環(huán)境下,利用所學(xué)C++語(yǔ)言和數(shù)據(jù)結(jié)構(gòu)的相關(guān)知識(shí),編寫程序系統(tǒng)主要實(shí)現(xiàn)圖書館的增加圖書、查詢圖書、刪除圖書、借閱圖書、還書;增加

    2024年02月11日
    瀏覽(19)
  • 云借閱圖書管理系統(tǒng)的測(cè)試項(xiàng)目實(shí)踐

    云借閱圖書管理系統(tǒng)的測(cè)試項(xiàng)目實(shí)踐

    項(xiàng)目背景:通過(guò)學(xué)習(xí)到的 SSM(Spring + SpringMVC + MyBatis)框架知識(shí)來(lái)實(shí)現(xiàn)一個(gè)前后端分離的云借閱圖書管理系統(tǒng)。 目標(biāo):完成系統(tǒng)搭建,用戶和圖書相關(guān)模塊編寫,在 SSM 框架整合的基礎(chǔ)上實(shí)現(xiàn)系統(tǒng)功能。 時(shí)間:2022-11-30 到 2022-12-26。 項(xiàng)目成員: 項(xiàng)目經(jīng)理:lyg 產(chǎn)品經(jīng)理:cch 開(kāi)

    2024年02月10日
    瀏覽(25)
  • 基于SSM框架的借閱圖書管理系統(tǒng)

    基于SSM框架的借閱圖書管理系統(tǒng)

    目錄 一、功能 二、開(kāi)發(fā)環(huán)境 三、系統(tǒng)項(xiàng)目文件組織結(jié)構(gòu) 四、數(shù)據(jù)庫(kù)設(shè)計(jì) 1.用戶表 2.圖書表 3.借閱記錄表 五、頁(yè)面展示 1.登錄頁(yè)面 2.用戶端 3.管理員端 六、源碼 本系統(tǒng)后臺(tái)使用SSM框架編寫,前臺(tái)頁(yè)面使用當(dāng)前主流的Bootstrap和jQuery框架編寫。 借閱圖書管理系統(tǒng)主要實(shí)現(xiàn)了兩

    2024年02月09日
    瀏覽(26)
  • 云借閱圖書管理系統(tǒng)[基于SSM框架的項(xiàng)目]

    云借閱圖書管理系統(tǒng)[基于SSM框架的項(xiàng)目]

    SSM框架本學(xué)期也是剛進(jìn)行完答辯,在云借閱圖書管理系統(tǒng)的基礎(chǔ)功能上 新增了一些功能 用來(lái)作為SSM框架的大作業(yè)進(jìn)行的答辯。也是對(duì) MyBatis框架、Spring框架、Spring MVC框架 的注解開(kāi)發(fā)有了一定的理解。下面給大家展示效果圖,有對(duì)這個(gè)項(xiàng)目感興趣的可以到我的 下載資源 里下

    2024年02月05日
    瀏覽(22)
  • 第七章:借閱管理【基于Servlet+JSP的圖書管理系統(tǒng)】

    第七章:借閱管理【基于Servlet+JSP的圖書管理系統(tǒng)】

    1.1 查詢借書卡 ??借書卡在正常的 CRUD 操作的基礎(chǔ)上,我們還需要注意一些特殊的情況。查詢信息的時(shí)候。如果是管理員則可以查詢所有的信息,如果是普通用戶則只能查看自己的信息。這塊的控制在登錄的用戶信息 然后就是在Dao中處理的時(shí)候需要考慮根據(jù)當(dāng)前登錄用戶查

    2024年02月11日
    瀏覽(19)
  • 基于Java的圖書借閱網(wǎng)站, java+springboot+vue開(kāi)發(fā)的圖書借閱管理系統(tǒng) - 畢業(yè)設(shè)計(jì) - 課程設(shè)計(jì)

    基于Java的圖書借閱網(wǎng)站, java+springboot+vue開(kāi)發(fā)的圖書借閱管理系統(tǒng) - 畢業(yè)設(shè)計(jì) - 課程設(shè)計(jì)

    本程序?qū)崿F(xiàn)圖書的智能化、信息化和簡(jiǎn)單化;實(shí)現(xiàn)圖書信息的增加、刪除、修改、查找、借閱、還書、收藏的顯示操作及實(shí)時(shí)數(shù)據(jù)庫(kù)的提交和更改和對(duì)普通用戶的增、刪、改、查;提高圖書管理員工作信息報(bào)送及反饋的工作效率,減輕管理員的勞動(dòng)負(fù)擔(dān);提高信息的及時(shí)性和

    2024年04月28日
    瀏覽(25)

覺(jué)得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包