def showAllStudentRanking(root):
    root.destroy()
    root = Tk()
    root.geometry('1250x790')
    myFont = fonts.Font(family='Georgia',size=14)
    headerFont = fonts.Font(family='Century Schoolbook',size=30)
    insertFont = fonts.Font(family='Century Schoolbook',size=9)

    Label(root, text='Student Rating (Descending Order)', fg='red', font=headerFont).place(x=320, y=50)
    tv = Treeview(root, columns=(1, 2, 3, 4), show="headings", height='15')

    style = ttk.Style()
    style.configure("Treeview", font=myFont, rowheight=30, bg ='#c6c6c6', relief='flat')
    style.configure("Treeview.Heading", font=insertFont, bg='#c6c6c6')

    tv.heading(1, text='Rank Number')
    tv.heading(2, text='Student ID')
    tv.heading(3, text='Codeforces Rating')
    tv.heading(4, text='Overall Rating')
    conn = Cx.connect('iutpc/iutpcadmin@localhost/orcl')
    cur = conn.cursor()
    stmt = 'select userid,cf_rating, OVERALL_RATING from current_rating order by overall_rating desc'
    cur.execute(stmt)
    rs = cur.fetchall()
    curr = 1
    for row in rs:
        sid = curr
        un = row[0]
        vj = row[1]
        cf = row[2]
        tv.insert("", "end", values=(sid, un, vj, cf))
        curr += 1
    tv.place(x=240, y=180)
    Button(root, text='Go Back', fg='white', bg='black', width=20, font=myFont, command=lambda: adminWelcomePage(root)).place(x=515, y=720)
Exemple #2
0
class BookLendingWindow:
    def __init__(self):
        self.win = Tk()
        self.canvas = Canvas(self.win, width=800, height=420, bg='white')
        self.canvas.pack(expand=YES, fill=BOTH)

        # show window in center of the screen
        width = self.win.winfo_screenwidth()
        height = self.win.winfo_screenheight()
        x = int(width / 2 - 800 / 2)
        y = int(height / 2 - 420 / 2)
        str1 = "800x420+" + str(x) + "+" + str(y)
        self.win.geometry(str1)

        # disable resize window
        self.win.resizable(False, False)

        # changing title of the window
        self.win.title("| BOOK LENDING DETAILS | LIBRARY MANAGEMENT SYSTEM |")

    def add_frame(self):
        self.frame = Frame(self.win, height=420, width=800)
        self.frame.place(x=0, y=0)

        x, y = 0, 0

        self.label = Label(self.frame,
                           text="VIEW BOOK LENDING DETAILS",
                           fg='black')
        self.label.config(font=("Poppins", 20, 'underline bold'))
        self.label.place(x=185, y=30)

        # use tree view to show details from the table
        self.tr = Treeview(self.frame,
                           columns=('A', 'B', 'C'),
                           selectmode="extended")

        # heading key + text
        self.tr.heading('#0', text='BOOK_ID')
        self.tr.column('#0', minwidth=0, width=120, stretch=NO)
        self.tr.heading('#1', text='STUDENT_ID')
        self.tr.column('#1', minwidth=0, width=120, stretch=NO)
        self.tr.heading('#2', text='ISSUE_DATE')
        self.tr.column('#2', minwidth=0, width=120, stretch=NO)
        self.tr.heading('#3', text='RETURN_DATE')
        self.tr.column('#3', minwidth=0, width=120, stretch=NO)
        # self.tr.heading('#4', text='FINE')
        # self.tr.column('#4', minwidth=0, width=100, stretch=NO)

        j = 0
        for i in Database.database.BookLend():
            self.tr.insert('', index=j, text=i[0], values=(i[1], i[2], i[3]))
            j += 1

        self.tr.place(x=155, y=y + 100)

        self.win.mainloop()
Exemple #3
0
class hey:
    def __init__(self):
        self.star1 = Toplevel()
        self.obj = database.Database()
        self.result = self.obj.getmenu()
        self.star1.geometry('1366x768')
        self.can = Canvas(self.star1, height=768, width=1366)
        self.can.pack()
        self.img = PhotoImage(file='./image/654.png')
        self.can.create_image(0, 0, image=self.img, anchor=NW)
        self.table = Treeview(self.can, columns=("#0", "#1", "#2", "#3", "#4"))
        self.table.heading('#0', text="Sr no.")
        self.table.column('#0', width=40)
        self.table.heading('#1', text="Name")
        self.table.column('#1', width=100)
        self.table.heading('#2', text="Amount")
        self.table.column('#2', width=100)
        self.table.heading('#3', text="edit")
        self.table.column('#3', width=100)
        self.table.heading('#4', text="delete")
        self.table.column('#4', width=100)
        for i in self.result:
            self.table.insert('',
                              'end',
                              text=i[0],
                              values=(i[1], i[2], "edit", "Delete"))
        self.table.place(x=300, y=300)
        self.btn = Button(self.can,
                          text="<- Back",
                          fg='white',
                          bg='black',
                          font=('monaco', 15, 'bold'),
                          command=self.back)
        self.btn.place(x=810, y=540)
        self.table.bind("<Double-Button-1>", self.trigger)
        self.star1.resizable(height=False, width=False)
        self.star1.state("zoomed")
        self.star1.mainloop()

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

    def trigger(self, e):
        f = self.table.focus()
        x = self.table.item(f)
        col = self.table.identify_column(e.x)
        if (col == "#3"):
            self.star1.destroy()
            obj = updatemenu.UpdateMenu(x["text"])
        elif (col == "#4"):
            self.star1.destroy()
            d = database.Database()
            d.delete(x["text"])
class ShowIncome:
    def __init__(self):
        self.win = Tk()
        canvas = Canvas(self.win, width=800, height=400, bg='white')
        canvas.pack(expand=YES, fill=BOTH)

        width = self.win.winfo_screenwidth()
        height = self.win.winfo_screenheight()

        x = int(width / 2 - 800 / 2)
        y = int(height / 2 - 400 / 2)

        str1 = "800x400+" + str(x) + "+" + str(y)
        self.win.geometry(str1)
        self.win.resizable(width=False, height=False)
        self.win.title("Show Income | Administrator")

    def add_frame(self):

        self.frame = Frame(self.win, width=600, height=350)
        self.frame.place(x=80, y=20)

        x, y = 70, 20

        # use treeview to show the data in forms of table
        #mention the number of columns
        self.tr = Treeview(self.frame,
                           columns=('A', 'B', 'C', 'D'),
                           selectmode="extended")
        # heading key + text
        self.tr.heading('#0', text='Sr No')
        self.tr.column('#0', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#1', text='Source')
        self.tr.column('#1', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#2', text='Description')
        self.tr.column('#2', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#3', text='Update')
        self.tr.column('#3', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#4', text='Delete')
        self.tr.column('#4', minwidth=0, width=100, stretch=NO)

        j = 0
        for i in db.db.show_income():
            self.tr.insert('',
                           index=j,
                           text=i[0],
                           values=(i[1], i[2], 'Update', 'Delete'))
            j += 1

        self.tr.place(x=50, y=y + 50)

        self.win.mainloop()
def showRanklist(root, cid):
    root.destroy()
    root = Tk()
    root.geometry('1400x790')
    myFont = fonts.Font(family='Georgia', size=16)
    headerFont = fonts.Font(family='Century Schoolbook', size=30)
    insertFont = fonts.Font(family='Century Schoolbook', size=12)
    root.title('Contest Ranklist')
    Label(root, text='Contest Ranklist', fg='red', font=headerFont).place(x=500, y=50)

    tv = Treeview(root, columns=(1, 2, 3, 4, 5), show="headings", height='15')

    style = ttk.Style()
    style.configure("Treeview", font=insertFont, rowheight=30, bg='#c6c6c6', relief='flat', width=80)
    style.configure("Treeview.Heading", font=myFont, bg='#c6c6c6')

    tv.heading(1, text='Position')
    tv.heading(2, text='Student ID')
    tv.heading(3, text='Solved')
    tv.heading(4, text='Time Penalty')
    tv.heading(5, text='Rating Change')

    conn = Cx.connect('iutpc/iutpcadmin@localhost/orcl')
    cur = conn.cursor()
    stmt = 'select userid, point_gained, time_penalty,change_rating  from ranklist where contest_id = \'' + cid + '\''
    cur.execute(stmt)
    rs = cur.fetchall()
    curr = 1
    ranklist = []
    for row in rs:
        un = row[0]
        vj = row[1]
        cf = row[2]
        rj = row[3]
        ranklist.append((curr, un, vj, cf, rj))
    ranklist.sort(key=lambda x: (x[2], -x[3]), reverse=True)
    for item in ranklist:
        un = item[1]
        vj = item[2]
        cf = item[3]
        rj = item[4]
        tv.insert("", "end", values=(curr, un, vj, cf, rj))
        curr += 1
    tv.place(x=200, y=180)
    Button(root, text='Go Back', fg='white', bg='black', width=20, font=myFont,
           command=lambda: showPreviousContest(root)).place(x=540, y=700)

    root.mainloop()
def approvePendingRequest(root):
    root.destroy()
    root = Tk()
    root.title('pending request')
    root.geometry('1200x750')
    root.resizable(FALSE, FALSE)

    myFont = fonts.Font(family='Georgia',size=14)
    headerFont = fonts.Font(family='Century Schoolbook',size=26)
    insertFont = fonts.Font(family='Century Schoolbook',size=9)


    Label(root, text='Pending Approval', fg='red', font=(headerFont)).place(x=470, y=50)
    entry1 = Entry(root, width=28 ,font = myFont, justify=CENTER, border=3)
    b1 = Button(root, text='Authorize', fg='red', bg='#c7c7c7', width=20, font = myFont, padx=0, pady=0, justify=CENTER,
                command=lambda: approveStudent(root, entry1.get(), 0))
    b2 = Button(root, text='Go Back', fg='white', bg='black', width=30, font= myFont, padx=0, pady=0, justify=CENTER,
                command=lambda: adminWelcomePage(root))
    b3 = Button(root, text='Delete Request', fg='black', bg='#c7c7c7', width=20, font= myFont, padx=0, pady=0, justify=CENTER,
                command=lambda: approveStudent(root, entry1.get(), 1))
    entry1.place(x=220, y=130)
    b1.place(x=590, y=125)
    b2.place(x=450, y=650)
    b3.place(x=830, y=125)
    tv = Treeview(root, columns=(1, 2, 3, 4, 5), show="headings", height='12')

    style = ttk.Style()
    style.configure("Treeview", font=myFont, rowheight=30, bg ='#c6c6c6', relief='flat')
    style.configure("Treeview.Heading", font=insertFont, bg='#c6c6c6')

    tv.heading(1, text='Student ID')
    tv.heading(2, text='Name')
    tv.heading(3, text='Vjudge Handle')
    tv.heading(4, text='Codeforces Handle')
    tv.heading(5, text='Toph Handle')
    conn = Cx.connect('iutpc/iutpcadmin@localhost/orcl')
    cur = conn.cursor()
    stmt = 'select * from pending_req'
    cur.execute(stmt)
    rs = cur.fetchall()
    for row in rs:
        sid = row[0]
        un = row[1]
        vj = row[3]
        cf = row[4]
        toph = row[5]
        tv.insert("", "end", values=(sid, un, vj, cf, toph), tags=("red"))
    tv.place(x=110, y=200)
class main:
    def __init__(self):
        self.win=Tk()
        height=self.win.winfo_screenheight()
        width=self.win.winfo_screenwidth()
        x=(width-700)//2
        y=(height-700)//2
        self.win.geometry('700x700+{}+{}'.format(str(x),str(y)))
        self.win.resizable(width=False, height=False)
        
        self.frame=Frame(self.win, height=700, width=700,bg="#334d4d")
        self.frame.place(x=0,y=0)
        
        self.frame1=Frame(self.frame, height=700, width=3, bg="#669999")
        self.frame1.place(x=5,y=0)
        self.frame2=Frame(self.frame, height=500, width=3, bg="#a3c2c2")
        self.frame2.place(x=15,y=0)
        self.frame3=Frame(self.frame, height=700, width=3, bg="#00756e")
        self.frame3.place(x=20,y=0)
        self.frame3=Frame(self.frame, height=200, width=3, bg="#e0ebeb")
        self.frame3.place(x=25,y=0)

        self.table=Treeview(self.frame, column=("#0","#1","#2","#3","#4","#5","#6"))
        self.table=Treeview(self.frame, column=("#0","#1","#2","#3","#4","#5","#6","#7"))
        style=ttk.Style()
        style.theme_use("alt")
        ttk.Style().configure("Treeview.Heading" ,font=('',10,"bold"))
        

        self.table.column("#0", width=70)
        self.table.column("#1", width=90)
        self.table.column("#2", width=80)
        self.table.column("#3", width=80)
        self.table.column("#4", width=80)
        self.table.column("#5", width=80)
        self.table.column("#6", width=80)
                
        self.table.heading("#0",text="Sr.")
        self.table.heading("#1",text="Patient Name")
        self.table.heading("#2",text="Gender")
        self.table.heading("#3",text="Age")
        self.table.heading("#4",text="Timing")
        self.table.heading("#5",text="Description")
        self.table.heading("#6",text="History")
    
        self.table.place(x=60,y=50, width=560,)

        self.win.mainloop()
class GUI:
    def __init__(self):
        self.window = Tk()
        self.window.geometry('800x600')
        self.txt = Entry(self.window, width=20)
        self.txt.grid(column=1, row=0)
        self.tree = Treeview(self.window, selectmode='browse')
        self.db = Database()
        self.lbl_url = Label(self.window, text="Введите URL")
        self.lbl_tab = Label(self.window, text="Данные из базы")

    def load_into_db(self):
        res = f'{self.txt.get()}'
        self.db.write_db(Parser(res))
        messagebox.showinfo('TAGS', str(Parser(res).tags()))

    def load_from_db(self):
        self.tree.delete(*self.tree.get_children())
        for row in self.db.read_db():
            self.tree.insert("", 'end', text=row)

    def wind(self):
        self.lbl_url.place(x=375, y=15)
        self.lbl_tab.place(x=360, y=120)
        btn = Button(self.window,
                     text="Загрузить в базу",
                     command=self.load_into_db)
        btn.grid(column=2, row=0)
        btn1 = Button(self.window,
                      text="Показать из базы",
                      command=self.load_from_db)
        btn1.grid(column=2, row=0)
        self.tree.place(x=25, y=150, width=750, height=300)
        scroll = Scrollbar(self.window,
                           orient="vertical",
                           command=self.tree.yview)
        scroll.place(x=775, y=200, height=150)
        self.tree.configure(yscrollcommand=scroll.set)
        self.txt.place(x=150, y=50, width=500, height=35)
        btn.place(x=450, y=500)
        btn1.place(x=150, y=500)
        self.window.mainloop()
Exemple #9
0
class Window:
    def __init__(self):

        self.tk = Tk()
        self.tk.geometry('500x500')
        fetch = (getdata.fetch())
        self.tree = Treeview(self.tk, columns=("#1", "#2", "#3", "#4"))
        self.tree.heading("#0", text="user id")
        self.tree.column("#0", width=60)
        self.tree.heading("#1", text="User Name")
        self.tree.heading("#2", text="Password")
        self.tree.heading("#3", text="Update")
        self.tree.heading("#4", text="Delete")
        self.data = getdata.fetch()
        for i in self.data:
            self.tree.insert('',
                             'end',
                             text=i[0],
                             values=(i[1], i[2], "update", "delete"))
        self.tree.place(x=0, y=0)

        self.tree.bind("<Double-Button-1>", self.trigger)

        self.tk.mainloop()

    def trigger(self, e):
        #e will identify from where the function has been triggered
        print(e)
        #d will store the object of focused element in the treeview
        d = self.tree.focus()
        #self.tree.item is use to get the data from the focused row
        #so thats why we pass the focused item there d
        x = (self.tree.item(d))
        print(x)
        #col will identify the focused column
        col = self.tree.identify_column(e.x)
        if col == "#3":

            print("Update")
        elif col == "#4":
            getdata.delete(x["text"])
            print("delete")
def showPreviousContest(root):
    root.destroy()
    root = Tk()
    root.geometry('860x790')
    myFont = fonts.Font(family='Georgia',size=16)
    headerFont = fonts.Font(family='Century Schoolbook',size=26)
    insertFont = fonts.Font(family='Century Schoolbook', size=12)
    root.title('Previous Contest')
    Label(root, text='Previous Contest', fg='red', font=headerFont).place(x=320, y=50)
    entry1 = Entry(root, width=20, font=myFont, border=5, justify=CENTER)
    b1 = Button(root, text='Show Ranklist', fg='red', bg='#c6c6c6',width=13, font=myFont, border=5,
                command=lambda: showRanklist(root, entry1.get()))
    entry1.place(x=190, y=140)
    b1.place(x=480, y=133)

    tv = Treeview(root, columns=(1, 2, 3), show="headings", height=15)

    style = ttk.Style()
    style.configure("Treeview", font=insertFont, rowheight=30, bg='#c6c6c6', relief='flat',width=80)
    style.configure("Treeview.Heading", font=myFont, bg='#c6c6c6')

    tv.heading(1, text='Contest ID')
    tv.heading(2, text='Contest Name')
    tv.heading(3, text='Contest URL')

    conn = Cx.connect('iutpc/iutpcadmin@localhost/orcl')
    cur = conn.cursor()
    stmt = 'select contest_id,contest_name,contest_url from contest_info'
    cur.execute(stmt)
    rs = cur.fetchall()
    curr = 1
    for row in rs:
        un = row[0]
        vj = row[2]
        cf = row[1]
        tv.insert("", "end", values=(un, vj, cf))
    tv.place(x=120, y=200)
    Button(root, text='Go Back', fg='white', bg='black', width=30, font=myFont,
           command=lambda: adminWelcomePage(root)).place(x=240, y=720)

    root.mainloop()
def ShowStudentDetails(root):
    root.destroy()
    root = Tk()
    myFont = fonts.Font(family='Georgia', size=16)
    headerFont = fonts.Font(family='Century Schoolbook', size=30)
    insertFont = fonts.Font(family='Century Schoolbook', size=12)
    root.title('Student List')
    root.geometry('1200x750')
    root.resizable(FALSE, FALSE)
    Label(root, text='Student List', fg='red', font=headerFont).place(x=475, y=70)
    b2 = Button(root, text='Go Back', fg='white', bg='black', width=20, font=myFont,
                command=lambda: adminWelcomePage(root))
    b2.place(x=460, y=680)

    tv = Treeview(root, columns=(1, 2, 3, 4, 5), show="headings", height='15')

    style = ttk.Style()
    style.configure("Treeview", font=insertFont, rowheight=30, bg='#c6c6c6', relief='flat', width=80)
    style.configure("Treeview.Heading", font=myFont, bg='#c6c6c6')

    tv.heading(1, text='Student ID')
    tv.heading(2, text='Name')
    tv.heading(3, text='Vjudge Handle')
    tv.heading(4, text='Codeforces Handle')
    tv.heading(5, text='Rating')
    conn = Cx.connect('iutpc/iutpcadmin@localhost/orcl')
    cur = conn.cursor()
    stmt = 'select user_info.userid,user_info.name, handle_info.vjudge_handle, handle_info.cf_handle, current_rating.overall_rating from user_info, handle_info,current_rating where user_info.adminaccess=0 and user_info.userid = handle_info.userid and current_rating.userid = user_info.userid order by current_rating.overall_rating desc'
    cur.execute(stmt)
    rs = cur.fetchall()
    for row in rs:
        SID = row[0]
        un = row[1]
        vj = row[2]
        cf = row[3]
        rat = row[4]
        tv.insert("", "end", values=(SID, un, vj, cf, rat))
    tv.place(x=100, y=160)
    return
def pat_list():
    global tr

    # CLEAR = Button(center_frame, text=" CLEAR ", command=clear_text)
    # CLEAR.pack()
    CLEAR_TREE = Button(rootp, text=" Clear the table ", command=clear_tree)
    CLEAR_TREE.place()
    # CLEAR_TREE.pack()

    # right_frame = Frame(rootd, relief='raised', borderwidth=3)
    # # center_frame.pack(fill=None, expand=False)
    # right_frame.place(relx=0.65, rely=0.15, anchor=E)

    style = Style()
    style.configure("BW.TLabel", foreground="white", background="black")

    x, y = 1000, 80

    # use tree view to show the data in forms of table
    # mention the number of columns
    tr = Treeview(rootp, columns=('A', 'B', 'C', 'D', 'E'), style="BW.TLabel", selectmode="extended")
    tr.place(anchor=W)
    # heading key + text
    tr.heading('#0', text='Sr no')
    tr.column('#0', minwidth=0, width=100, stretch=NO)
    tr.heading('#1', text='Patient Name')
    tr.column('#1', minwidth=0, width=100, stretch=NO)
    tr.heading('#2', text='Gender')
    tr.column('#2', minwidth=0, width=100, stretch=NO)
    tr.heading('#3', text='Patient Id')
    tr.column('#3', minwidth=0, width=100, stretch=NO)
    tr.heading('#4', text='Address')
    tr.column('#4', minwidth=0, width=100, stretch=NO)
    tr.heading('#5', text='Consulting Doc Id')
    tr.column('#5', minwidth=0, width=100, stretch=NO)

    show_records()

    tr.place(x=900, y=y + 100)
Exemple #13
0
                       width=170,
                       minwidth=170,
                       anchor=CENTER)
tree_Fornecedor.column('#3',
                       stretch=YES,
                       width=140,
                       minwidth=140,
                       anchor=CENTER)
tree_Fornecedor.column('#2', stretch=YES, width=300, minwidth=300, anchor=W)
tree_Fornecedor.column('#1',
                       stretch=YES,
                       width=160,
                       minwidth=160,
                       anchor=CENTER)
tree_Fornecedor.column('#0', stretch=YES, width=60, minwidth=60, anchor=CENTER)
tree_Fornecedor.place(x=0, y=5)
#tree_Fornecedor.tag_configure('MonoMetas', background=Branco, font=Fonte12, foreground=Preto)
tree_Fornecedor.tag_configure('oddrow',
                              background=Cinza40,
                              font=Fonte12,
                              foreground=Branco)
barra3 = Scrollbar(tree_Fornecedor,
                   orient='vertical',
                   command=tree_Fornecedor.yview)
barra3.place(x=828, y=1, height=225)
tree_Fornecedor.configure(yscrollcommand=barra3.set)
# ---------------------------------------------------------------------------------------------------------------------
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=
# Labels do Total da Nota
Lb_Desc = Label(FrTotal, bg=Cinza40, text="DESC:", fg=Branco, font=Fonte12B)
Lb_Desc.place(x=44, y=8, height=20)
Exemple #14
0
class view:
    def __init__(self, f):
        self.bgc = "white"
        self.form = f
        self.presenter = present(self)
        self.place_startpage()

##############################################################################
# 1. Start page

    def init_startpage(self):
        table_headings = ["Название", "Длина", "Дата создания"]

        self.route_table = Treeview(self.form, selectmode="browse", \
         show='headings', height = 25)

        self.route_table["columns"] = table_headings
        self.route_table["displaycolumns"] = table_headings

        for head in table_headings:
            self.route_table.heading(head, text=head, anchor=CENTER)

        colomn_width = 200
        self.route_table.column("Название", anchor=CENTER, width=colomn_width)
        self.route_table.column("Длина", anchor=CENTER, width=colomn_width)
        self.route_table.column("Дата создания",
                                anchor=CENTER,
                                width=colomn_width)

        self.about_route_button = Button(self.form, text="Подробно",\
         width=15,height=3, command=self.about_route)

        self.delete_route_button = Button(self.form, text='Удалить',\
         width=15,height=3, command=self.delete_route)

        self.create_route_button = Button(self.form, text='Создать',\
         width=15,height=3, command=self.create_route)

        self.import_route_button = Button(self.form, text='Импорт',\
         width=15,height=3, command=self.import_route)

        self.presenter.fill_routes_table()

    def about_route(self):
        self.remove_startpage()
        self.place_about_route()

    def delete_route(self):
        pass

    def create_route(self):
        self.remove_startpage()
        self.place_create_route()

    def import_route(self):
        pass

    def place_startpage(self):
        self.init_startpage()
        but_y = 530
        self.route_table.place(x=100, y=0)
        self.about_route_button.place(x=0, y=but_y)
        self.delete_route_button.place(x=220, y=but_y)
        self.create_route_button.place(x=430, y=but_y)
        self.import_route_button.place(x=650, y=but_y)

    def remove_startpage(self):
        self.route_table.destroy()
        self.about_route_button.destroy()
        self.delete_route_button.destroy()
        self.create_route_button.destroy()
        self.import_route_button.destroy()

##############################################################################
# 2. About route

    def init_about_route(self):
        table_headings = ["№ точки", "Долгота", "Широта", "Высота"]

        self.point_table = Treeview(self.form, selectmode="browse", \
         show='headings', height = 25)

        self.point_table["columns"] = table_headings
        self.point_table["displaycolumns"] = table_headings

        for head in table_headings:
            self.point_table.heading(head, text=head, anchor=CENTER)

        colomn_width = 150
        self.point_table.column("№ точки", anchor=CENTER, width=colomn_width)
        self.point_table.column("Долгота", anchor=CENTER, width=colomn_width)
        self.point_table.column("Широта", anchor=CENTER, width=colomn_width)
        self.point_table.column("Высота", anchor=CENTER, width=colomn_width)

        self.edit_point_button = Button(self.form, text="Редактировать",\
         width=15,height=3, command=self.edit_point)

        self.back_from_point_to_start_button = Button(self.form, text='Назад',\
         width=15,height=3, command=self.back_from_point_to_start)

        self.point_edit_entry = Text(self.form,
                                     height=1.2,
                                     width=16,
                                     font='Arial 12')

        #self.presenter.

    def edit_point(self):
        pass

    def back_from_point_to_start(self):
        self.remove_about_route()
        self.place_startpage()

    def place_about_route(self):
        self.init_about_route()
        self.point_table.place(x=100, y=0)
        self.edit_point_button.place(x=250, y=530)
        self.back_from_point_to_start_button.place(x=550, y=530)
        self.point_edit_entry.place(x=70, y=547)

    def remove_about_route(self):
        self.point_table.destroy()
        self.edit_point_button.destroy()
        self.back_from_point_to_start_button.destroy()
        self.point_edit_entry.destroy()

##############################################################################
# 2. About route

    def init_create_route(self):
        table_headings = ["№ точки", "Долгота", "Широта", "Высота"]

        self.point_table_create = Treeview(self.form, selectmode="browse", \
         show='headings', height = 25)

        self.point_table_create["columns"] = table_headings
        self.point_table_create["displaycolumns"] = table_headings

        for head in table_headings:
            self.point_table_create.heading(head, text=head, anchor=CENTER)

        colomn_width = 150
        self.point_table_create.column("№ точки",
                                       anchor=CENTER,
                                       width=colomn_width)
        self.point_table_create.column("Долгота",
                                       anchor=CENTER,
                                       width=colomn_width)
        self.point_table_create.column("Широта",
                                       anchor=CENTER,
                                       width=colomn_width)
        self.point_table_create.column("Высота",
                                       anchor=CENTER,
                                       width=colomn_width)

        self.add_point_button = Button(self.form, text="Добавить",\
         width=15,height=3, command=self.add_point)

        self.save_route_button = Button(self.form, text='Сохранить',\
         width=15,height=3, command=self.save_route)

        self.new_route_name_entry = Text(self.form,
                                         height=1.2,
                                         width=16,
                                         font='Arial 12')

        self.new_route_name_label = Label(text='Имя маршрута:',\
                font = 'Arial 16', bg = self.bgc)

        self.new_point_entry = Text(self.form,
                                    height=1.2,
                                    width=16,
                                    font='Arial 12')

    def add_point(self):
        pass

    def save_route(self):
        pass

    def place_create_route(self):
        self.init_create_route()
        self.point_table_create.place(x=100, y=50)
        self.add_point_button.place(x=200, y=610)
        self.save_route_button.place(x=450, y=600)
        self.new_route_name_label.place(x=225, y=0)
        self.new_route_name_entry.place(x=380, y=4)
        self.new_point_entry.place(x=200, y=580)

##############################################################################
# Interfaces

    def insert_into_route_table(self, routes):
        for i in range(len(routes)):
            self.route_table.insert('', END, values=tuple(routes[i]))
Exemple #15
0
class user:
    def __init__(self, root, background_color, user_login, cursor):
        self.r = root
        self.bgc = background_color
        self.login = user_login
        self.cur = cursor

        self.cur.execute(
            "select client_id from client where client_login = '******';")
        tmp = self.cur.fetchall()
        self.userid = tmp[0][0]

        self.today_date = '{0:%Y-%m-%d %H:%M:%S} '.format(
            datetime.datetime.now())

##############################################################################
# 1. START

# 1.1 INIT

    def init_start_widgets(self):
        self.choose_button = Button(self.r,
                                    text="Записаться",
                                    width=20,
                                    height=7,
                                    command=self.choose)
        self.my_workouts_button = Button(self.r,
                                         text="Мои занятия",
                                         width=20,
                                         height=7,
                                         command=self.show_my_workouts)

    # 1.2 PLACE
    def place_start(self):
        self.init_start_widgets()
        self.choose_button.place(x=200, y=240)
        self.my_workouts_button.place(x=400, y=240)

    # 1.3 REMOVE
    def remove_start(self):
        self.choose_button.destroy()
        self.my_workouts_button.destroy()

    # 1.4 COMMANDS
    def choose(self):
        self.remove_start()
        self.place_choose()

    def show_my_workouts(self):
        self.remove_start()
        self.place_my_worklouts()

##############################################################################

##############################################################################
# 2. CHOOSE CLUB AND KIND OF SPORT

# 2.1 INIT

    def init_choose_widgets(self, root):
        self.choose_label = Label(text='Выберите клуб и вид спорта:',\
                font = 'Arial 20', bg = self.bgc)

        q = get_all_clubs()
        self.cur.execute(q)
        tmp = self.cur.fetchall()

        clubs = []

        for i in range(len(tmp)):
            clubs.append(tmp[i][0])

        self.variable_c = StringVar(root)
        self.variable_c.set(clubs[0])  # default value
        self.clubs_option_menu = OptionMenu(root, self.variable_c, *clubs)
        self.clubs_option_menu.config(width=20, height=3, bg=self.bgc, font=16)

        q = get_all_sports()
        self.cur.execute(q)
        tmp = self.cur.fetchall()

        kind_of_sport = []

        for i in range(len(tmp)):
            kind_of_sport.append(tmp[i][0])

        self.variable_k = StringVar(root)
        self.variable_k.set(kind_of_sport[0])
        self.kind_of_sport_option_menu = OptionMenu(root, self.variable_k,
                                                    *kind_of_sport)
        self.kind_of_sport_option_menu.config(width=20,
                                              height=3,
                                              bg=self.bgc,
                                              font=16)

        self.next_in_choose_button = Button(root, text='Далее',width=15,\
         height=3,command=self.next_in_choose)

        self.back_to_start_button = Button(root, text='Назад',width=15,height=3,\
         command=self.back_to_start)

    # 2.2 PLACE
    def place_choose(self):
        self.init_choose_widgets(self.r)
        self.choose_label.place(x=200, y=160)
        self.clubs_option_menu.place(x=260, y=200)
        self.kind_of_sport_option_menu.place(x=260, y=300)
        self.next_in_choose_button.place(x=305, y=400)
        self.back_to_start_button.place(x=305, y=500)

    # 2.3 REMOVE
    def remove_choose(self):
        self.choose_label.destroy()
        self.clubs_option_menu.destroy()
        self.kind_of_sport_option_menu.destroy()
        self.next_in_choose_button.destroy()
        self.back_to_start_button.destroy()

    # 2.3 COMMANDS
    def next_in_choose(self):
        club = self.variable_c.get()
        kind_of_sport = self.variable_k.get()
        self.remove_choose()
        self.place_trainlist(club, kind_of_sport)

    def back_to_start(self):
        self.remove_choose()
        self.place_start()

##############################################################################

##############################################################################
# 3. TRAINLIST

# 3.1 INIT

    def init_trainlist_widgets(self, root, club, sport):
        headings = ["вид спорта", "тренер", "рейтинг","тип", "места", "дата",\
        "длительность"]

        self.trains_table = Treeview(root,
                                     selectmode="browse",
                                     show='headings',
                                     height=25)
        self.trains_table["columns"] = headings
        self.trains_table["displaycolumns"] = headings

        for head in headings:
            self.trains_table.heading(head, text=head, anchor=CENTER)

        self.trains_table.column("вид спорта", anchor=CENTER, width=180)
        self.trains_table.column("тренер", anchor=CENTER, width=180)
        self.trains_table.column("рейтинг", anchor=CENTER, width=70)
        self.trains_table.column("тип", anchor=CENTER, width=40)
        self.trains_table.column("места", anchor=CENTER, width=60)
        self.trains_table.column("дата", anchor=CENTER, width=145)
        self.trains_table.column("длительность", anchor=CENTER, width=120)

        q = get_actual_workouts(self.userid, self.today_date, club, sport)
        self.cur.execute(q)
        tmp = self.cur.fetchall()
        self.w_ids = []

        for train in tmp:
            train = list(train)
            poped = train.pop(len(train) - 1)
            self.w_ids.append(poped)
            self.trains_table.insert('', END, values=tuple(train))

        self.choose_train_button = Button(root,
                                          text="Выбрать",
                                          width=15,
                                          height=3,
                                          command=self.choose_train)
        self.back_to_choose_button = Button(root, text='Назад',width=15,height=3,\
         command=self.back_to_choose)

    # 3.2 PLACE
    def place_trainlist(self, club, kind_of_sport):
        self.init_trainlist_widgets(self.r, club, kind_of_sport)
        self.trains_table.place(x=0, y=0)
        self.choose_train_button.place(x=320, y=530)
        self.back_to_choose_button.place(x=0, y=530)

    # 3.3 REMOVE
    def remove_trainlist(self):
        self.trains_table.destroy()
        self.choose_train_button.destroy()
        self.back_to_choose_button.destroy()

    # 3.4 COMMANDS
    def choose_train(self):
        indd = self.trains_table.focus()
        if indd == "":
            messagebox.showinfo("", "Выберите тренировку")
        else:
            ind = int(convert_base(indd[1:], to_base=10, from_base=16)) - 1
            curr_workout_id = self.w_ids[ind]

            q = generate_insert_into_client_workout(self.userid,
                                                    curr_workout_id)
            self.cur.execute(q)

            q = generate_update_for_places_count(curr_workout_id)
            self.cur.execute(q)

            self.remove_trainlist()
            self.place_start()
            messagebox.showinfo("", "Подтверждено")

    def back_to_choose(self):
        self.remove_trainlist()
        self.place_choose()

##############################################################################

##############################################################################
# 4. MY_WORKOUTS

# 4.1 INIT

    def init_my_workouts_widgets(self, root):
        self.my_workouts_label = Label(text='Мои занятия:',\
                font = 'Arial 20', bg = self.bgc)
        self.past_workouts_button = Button(root,text="Прошедшие",width=17,height=10,\
         command=self.show_past)
        self.future_workouts_button = Button(root,text="Предстоящие",width=17,height=10,\
         command=self.show_future)
        self.back_to_start_button2 = Button(root, text='Назад',width=17,height=3,\
         command=self.back_to_start2)

    # 4.2 PLACE
    def place_my_worklouts(self):
        self.init_my_workouts_widgets(self.r)
        self.my_workouts_label.place(x=315, y=80)
        self.past_workouts_button.place(x=315, y=120)
        self.future_workouts_button.place(x=315, y=300)
        self.back_to_start_button2.place(x=315, y=500)

    # 4.3 REMOVE
    def remove_my_workouts(self):
        self.my_workouts_label.destroy()
        self.past_workouts_button.destroy()
        self.future_workouts_button.destroy()
        self.back_to_start_button2.destroy()

    # 4.4 COMMANDS
    def show_past(self):
        self.remove_my_workouts()
        self.place_past_workouts()

    def show_future(self):
        self.remove_my_workouts()
        self.place_future_workouts()

    def back_to_start2(self):
        self.remove_my_workouts()
        self.place_start()

##############################################################################

##############################################################################
# 5. PAST WORKOUTS

# 5.1 INIT

    def init_past_workouts_widgets(self, root):
        self.past_workouts_table = Treeview(root,
                                            selectmode="browse",
                                            show='headings',
                                            height=25)

        headings = [
            "клуб", "вид спорта", "тренер", "дата", "длительность",
            "ваша оценка"
        ]

        self.past_workouts_table["columns"] = headings
        self.past_workouts_table["displaycolumns"] = headings

        for head in headings:
            self.past_workouts_table.heading(head, text=head, anchor=CENTER)

        self.past_workouts_table.column("клуб", anchor=CENTER, width=115)
        self.past_workouts_table.column("вид спорта", anchor=CENTER, width=155)
        self.past_workouts_table.column("тренер", anchor=CENTER, width=165)
        self.past_workouts_table.column("дата", anchor=CENTER, width=135)
        self.past_workouts_table.column("длительность",
                                        anchor=CENTER,
                                        width=110)
        self.past_workouts_table.column("ваша оценка",
                                        anchor=CENTER,
                                        width=125)

        q = get_user_past_workouts(self.userid, self.today_date)
        self.cur.execute(q)
        tmp = self.cur.fetchall()
        self.w_ids_for_rating = []

        for train in tmp:
            train = list(train)
            poped = train.pop(len(train) - 1)
            self.w_ids_for_rating.append(poped)
            self.past_workouts_table.insert('', END, values=tuple(train))

        self.set_rating_button = Button(root,text="Поставить оценку",width=15,height=1, \
         command=self.set_rating)
        self.back_to_my_workouts_button = Button(root, text='Назад',width=15,height=3,\
         command=self.back_to_my_workouts)

        self.rating_entry = Text(root, height=1.2, width=16, font='Arial 12')

    # 5.2 PLACE
    def place_past_workouts(self):
        self.init_past_workouts_widgets(self.r)
        self.past_workouts_table.place(x=0, y=0)
        self.set_rating_button.place(x=320, y=530)
        self.back_to_my_workouts_button.place(x=0, y=530)
        self.rating_entry.place(x=320, y=560)

    # 5.3 REMOVE
    def remove_past_workouts(self):
        self.past_workouts_table.destroy()
        self.set_rating_button.destroy()
        self.back_to_my_workouts_button.destroy()
        self.rating_entry.destroy()

    # 5.4 COMMANDS
    def set_rating(self):
        indd = self.past_workouts_table.focus()

        if indd == "":
            messagebox.showinfo("", "Выберите тренировку")
        else:
            ind = int(convert_base(indd[1:], to_base=10, from_base=16)) - 1
            curr_workout_id = self.w_ids_for_rating[ind]

            q = get_current_workout_rating(self.userid, curr_workout_id)
            self.cur.execute(q)
            tmp = self.cur.fetchall()
            current_train_rating = tmp[0][0]

            if current_train_rating == " ":
                input_rating = self.rating_entry.get('1.0', 'end-1c')
                if input_rating.replace(".", "", 1).isdigit() == False:
                    messagebox.showinfo("", "Оценка введена некоректно")
                elif float(input_rating) < 0 or float(input_rating) > 5:
                    messagebox.showinfo(
                        "", "Оценка ставиться по пятибальной шкале")
                else:
                    input_rating = round(float(input_rating), 2)
                    q = update_rating(self.userid, curr_workout_id,
                                      input_rating)
                    self.cur.execute(q)

                    q = get_current_coach_id_rating(curr_workout_id)
                    self.cur.execute(q)
                    tmp = self.cur.fetchall()

                    tmp_coach_id = int(tmp[0][0])
                    tmp_coach_rating = tmp[0][1]
                    tmp_coach_marked_w_count = tmp[0][2]

                    new_rating = (tmp_coach_rating * tmp_coach_marked_w_count +
                                  input_rating) / (tmp_coach_marked_w_count +
                                                   1)
                    q = update_coach_rating(tmp_coach_id, new_rating)
                    self.cur.execute(q)

                    self.remove_past_workouts()
                    self.place_past_workouts()
            else:
                messagebox.showinfo(
                    "",
                    "Оценка уже выставлена. В соответствии с нашими правилами оценка выставляется один раз и не подлежит изменению"
                )

    def back_to_my_workouts(self):
        self.remove_past_workouts()
        self.place_my_worklouts()

##############################################################################

##############################################################################
# 6. FUTURE WORKOUTS

# 6.1 INIT

    def init_future_workouts_widgets(self, root):
        self.future_workouts_table = Treeview(root,
                                              selectmode="browse",
                                              show='headings',
                                              height=25)

        headings = [
            "клуб", "вид спорта", "тренер", "дата", "длительность", "рейтинг"
        ]

        self.future_workouts_table["columns"] = headings
        self.future_workouts_table["displaycolumns"] = headings

        for head in headings:
            self.future_workouts_table.heading(head, text=head, anchor=CENTER)

        self.future_workouts_table.column("клуб", anchor=CENTER, width=115)
        self.future_workouts_table.column("вид спорта",
                                          anchor=CENTER,
                                          width=155)
        self.future_workouts_table.column("тренер", anchor=CENTER, width=165)
        self.future_workouts_table.column("дата", anchor=CENTER, width=150)
        self.future_workouts_table.column("длительность",
                                          anchor=CENTER,
                                          width=110)
        self.future_workouts_table.column("рейтинг", anchor=CENTER, width=110)

        q = get_user_future_workouts(self.userid, self.today_date)
        self.cur.execute(q)
        tmp = self.cur.fetchall()
        self.w_ids_for_remove_workout = []

        for train in tmp:
            train = list(train)
            poped = train.pop(len(train) - 1)
            self.w_ids_for_remove_workout.append(poped)
            self.future_workouts_table.insert('', END, values=tuple(train))

        self.remove_workout_button = Button(root,
                                            text="Отменить тренировку",
                                            width=15,
                                            height=3,
                                            command=self.remove_workout)
        self.back_to_my_workouts_button2 = Button(root, text='Назад',width=15,height=3,\
         command=self.back_to_my_workouts2)

    # 6.2 PLACE
    def place_future_workouts(self):
        self.init_future_workouts_widgets(self.r)
        self.future_workouts_table.place(x=0, y=0)
        self.remove_workout_button.place(x=300, y=530)
        self.back_to_my_workouts_button2.place(x=0, y=530)

    # 6.3 REMOVE
    def remove_future_workouts(self):
        self.future_workouts_table.destroy()
        self.remove_workout_button.destroy()
        self.back_to_my_workouts_button2.destroy()

    # 6.4 COMMANDS
    def remove_workout(self):
        indd = self.future_workouts_table.focus()
        if indd == "":
            messagebox.showinfo("", "Выберите тренировку")
        else:
            ind = int(convert_base(indd[1:], to_base=10, from_base=16)) - 1
            curr_workout_id = self.w_ids_for_remove_workout[ind]

            q = delete_cancel_workout(self.userid, curr_workout_id)
            self.cur.execute(q)

            q = update_places(curr_workout_id)
            self.cur.execute(q)

            self.remove_future_workouts()
            self.place_future_workouts()

    def back_to_my_workouts2(self):
        self.remove_future_workouts()
        self.place_my_worklouts()
class ReturnWindow:
    def __init__(self):
        self.win = Tk()
        self.canvas = Canvas(self.win, width=800, height=420, bg='white')
        self.canvas.pack(expand=YES, fill=BOTH)

        # show window in center of the screen
        width = self.win.winfo_screenwidth()
        height = self.win.winfo_screenheight()
        x = int(width / 2 - 800 / 2)
        y = int(height / 2 - 420 / 2)
        str1 = "800x420+" + str(x) + "+" + str(y)
        self.win.geometry(str1)

        # disable resize window
        self.win.resizable(False, False)

        # changing title of the window
        self.win.title(
            "| BOOK RETURNING DETAILS | LIBRARY MANAGEMENT SYSTEM |")

    def add_frame(self):

        self.frame = Frame(self.win, height=420, width=800)
        self.frame.place(x=0, y=0)

        x, y = 0, 0

        self.label = Label(self.frame, text="RETURNING BOOKS", fg='black')
        self.label.config(font=("Poppins", 20, 'underline bold'))
        self.label.place(x=250, y=30)

        # use tree view to show details from the table
        self.tr = Treeview(self.frame,
                           columns=('BOOK_ID', 'STUDENT_ID', 'ISSUE_DATE',
                                    'RETURN_DATE'),
                           selectmode="extended")

        self.tr.heading('#0', text='BOOK_ID')
        self.tr.column('#0', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#1', text='STUDENT_ID')
        self.tr.column('#1', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#2', text='ISSUE_DATE')
        self.tr.column('#2', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#3', text='RETURN_DATE')
        self.tr.column('#3', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#4', text='RETURN')
        self.tr.column('#4', minwidth=0, width=100, stretch=NO)
        # self.tr.heading('#5', text='RETURN')
        # self.tr.column('#5', minwidth=0, width=100, stretch=NO)

        j = 0
        for i in Database.database.BookLend():
            self.tr.insert('',
                           index=j,
                           text=i[0],
                           values=(i[1], i[2], i[3], 'RETURN'))
            j += 1

        # create action on deletion
        self.tr.bind('<Double-Button-1>', self.bounce)
        self.tr.place(x=140, y=y + 100)

        self.win.mainloop()

    def bounce(self, e):
        # get the value of deleted row
        tt = self.tr.focus()
        # get the column id
        col = self.tr.identify_column(e.x)
        # print(col)
        # print(self.tr.item(tt))
        # print(self.tr.item(tt)['text'])
        # print(self.tr.item(tt)['values'][0])
        data = (
            str(self.tr.item(tt)['text']),
            str(self.tr.item(tt)['values'][0]),
        )

        if col == '#4':
            res = messagebox.askyesno("Message", "Do you want  to Return..!")
            if res:
                d, fine_days = Database.database.Return(data)
                if d:
                    message = ("Book Returned successfully..! \n Fine = ",
                               fine_days)
                    messagebox.showinfo("Message", message)
                    self.win.destroy()
                    x = Thirdpage
                    # x.add_frame()
            else:
                self.win.destroy()
                x = Student.Return.ReturnWindow()
                x.add_frame()
Exemple #17
0
class App_test(object):
    def __init__(self, master, fuc):
        self.win = master
        self.win.title('12306火车票查询系统V2.6')
        curWidth = self.win.winfo_width()
        curHeight = self.win.winfo_height()
        scnWidth, scnHeight = self.win.maxsize()
        tmpcnf = '1130x600+500+300'  # % ((scnWidth - curWidth) / 2, (scnHeight - curHeight) / 2)
        self.win.geometry(tmpcnf)
        self.creat_res()
        self.add_train_info()
        self.add_check_button()
        self.res_config(fuc)
        self.set_combox_defaut()
        self.train_message = {}

    # self.get_train_args()
    # self.win.mainloop()

    def creat_res(self):
        self.v = IntVar()  # 车票查询
        self.v.set(True)
        self.temp = StringVar()  # 开始站
        self.temp2 = StringVar()  # 目的站
        self.start_mon = StringVar()  # 出发月
        self.start_day = StringVar()  # 出发日
        self.start_year = StringVar()  # 出啊年
        self.La_start_end = Label(self.win, text="请输入出发地和目的地", fg="blue")
        self.E_startstation = Entry(self.win, textvariable=self.temp)
        self.E_endstation = Entry(self.win, textvariable=self.temp2)
        self.La_startstation = Label(self.win, text="出发站:")
        self.La_endstation = Label(self.win, text="目的站:")
        self.La_time = Label(self.win, text="请选择出发时间-年-月-日", fg="blue")
        self.B_search = Button(self.win, text="搜索")
        self.R_site = Radiobutton(self.win,
                                  text="车票查询",
                                  variable=self.v,
                                  value=True)
        self.R_price = Radiobutton(self.win,
                                   text="票价查询",
                                   variable=self.v,
                                   value=False)
        self.B_buy_tick = Button(self.win, text="购票")
        self.C_year = Combobox(self.win, textvariable=self.start_year)
        self.La_s = Label(self.win, text="--")
        self.C_mon = Combobox(self.win, textvariable=self.start_mon)
        self.La_s1 = Label(self.win, text="--")
        self.C_day = Combobox(self.win, textvariable=self.start_day)
        # 滚动条
        self.S_move = Scrollbar(self.win)
        self.La_start_end.place(x=10, y=10, width=150, height=30)
        self.E_startstation.place(x=70, y=50, width=145, height=30)
        self.E_startstation.insert(10, "杭州东")
        self.E_endstation.place(x=70, y=100, width=145, height=30)
        self.E_endstation.insert(10, "南京南")
        self.La_startstation.place(x=10, y=50, width=50, height=30)
        self.La_endstation.place(x=10, y=100, width=50, height=30)
        self.La_time.place(x=0, y=140, width=190, height=30)
        self.C_year.place(x=10, y=180, width=70, height=30)
        self.La_s.place(x=80, y=180, width=20, height=30)
        self.C_mon.place(x=100, y=180, width=50, height=30)
        self.La_s1.place(x=150, y=180, width=20, height=30)
        self.C_day.place(x=170, y=180, width=50, height=30)
        self.B_search.place(x=10, y=220, width=80, height=40)
        self.S_move.place(x=1100, y=40, width=30, height=550)
        self.B_buy_tick.place(x=10, y=310, width=80, height=40)
        self.R_site.place(x=10, y=270, width=90, height=30)
        self.R_price.place(x=100, y=270, width=90, height=30)

    def res_config(self, fuc):
        localTime = time.localtime(int(time.time()))
        # 获取今年的年份
        startTime = int(time.strftime("%Y", localTime))  # 2018
        self.C_year.config(
            values=[x for x in range(startTime, startTime + 10)])
        self.C_mon.config(values=["{:02d}".format(x)
                                  for x in range(1, 13)])  # 时间格式是2018-01-01
        self.C_day.config(values=["{:02d}".format(x) for x in range(1, 32)])
        self.B_search.config(command=fuc)
        self.S_move.config(command=self.tree.yview)
        self.tree.config(yscrollcommand=self.S_move.set)

    def add_train_info(self):
        lis_train = ["C" + str(x) for x in range(0, 15)]
        tuple_train = tuple(lis_train)
        self.tree = Treeview(self.win,
                             columns=tuple_train,
                             height=30,
                             show="headings")
        self.tree.place(x=228, y=40, width=870, height=550)
        train_info = [
            ' 车次 ', ' 出发/到达站', '出发/到达时间', '历时 ', '商/特座', '一等座', '二等座', '高软',
            '软卧', '动卧', '硬卧', '软座', '硬座', '无座', '其他'
        ]
        for i in range(0, len(lis_train)):
            self.tree.column(lis_train[i],
                             width=len(train_info[i]) * 11,
                             anchor='center')
            self.tree.heading(lis_train[i], text=train_info[i])

    def add_check_button(self):
        self.v1 = IntVar()
        self.v2 = IntVar()
        self.v3 = IntVar()
        self.v4 = IntVar()
        self.v5 = IntVar()
        self.v6 = IntVar()
        self.v7 = IntVar()
        self.v1.set("T")
        self.Check_total = Checkbutton(self.win,
                                       text="全部车次",
                                       variable=self.v1,
                                       onvalue='T')
        self.Check_total.place(x=228, y=7, width=90, height=30)
        self.Check_total = Checkbutton(self.win,
                                       text="G-高铁",
                                       variable=self.v2,
                                       onvalue='T')
        self.Check_total.place(x=318, y=7, width=70, height=30)
        self.Check_total = Checkbutton(self.win,
                                       text="D-动车",
                                       variable=self.v3,
                                       onvalue='T')
        self.Check_total.place(x=398, y=7, width=70, height=30)
        self.Check_total = Checkbutton(self.win,
                                       text="Z-直达",
                                       variable=self.v4,
                                       onvalue='T')
        self.Check_total.place(x=478, y=7, width=70, height=30)
        self.Check_total = Checkbutton(self.win,
                                       text="T-特快",
                                       variable=self.v5,
                                       onvalue='T')
        self.Check_total.place(x=558, y=7, width=70, height=30)
        self.Check_total = Checkbutton(self.win,
                                       text="K-快速",
                                       variable=self.v6,
                                       onvalue='T')
        self.Check_total.place(x=638, y=7, width=70, height=30)
        self.Check_total = Checkbutton(self.win,
                                       text="其他",
                                       variable=self.v7,
                                       onvalue='T')
        self.Check_total.place(x=718, y=7, width=70, height=30)

    # 设置下拉框默认值
    def set_combox_defaut(self):
        localTime = time.localtime(int(time.time()))
        mon = int(time.strftime("%m", localTime))
        day = int(time.strftime("%d", localTime))
        self.C_year.current(0)
        self.C_mon.current(mon - 1)
        self.C_day.current(day - 1)
Exemple #18
0
class ShowWindow:
    def __init__(self):
        self.win = Toplevel()
        canvas = Canvas(self.win, width=800, height=400, bg='white')
        canvas.pack(expand=YES, fill=BOTH)

        # show window in center of screen
        width = self.win.winfo_screenwidth()
        height = self.win.winfo_screenheight()
        x = int(width / 2 - 800 / 2)
        y = int(height / 2 - 400 / 2)
        str1 = "800x400+" + str(x) + "+" + str(y)
        self.win.geometry(str1)

        # Disable resize of the window
        self.win.resizable(width=False, height=False)
        self.win.title("truTrackerEXP | SHOW INCOME SOURCES")

    def add_frame(self):

        self.frame = Frame(self.win, width=600, height=350)
        self.frame.place(x=80, y=20)

        x, y = 70, 20

        # Use treeview to show the data in forms of table
        # Mention number of columns
        self.tr = Treeview(self.frame,
                           columns=('A', 'B', 'C', 'D'),
                           selectmode="extended")

        #  Heading key + text
        self.tr.heading('#0', text='Sr No')
        self.tr.column('#0', minwidth=0, width=40, stretch=NO)
        self.tr.heading('#1', text='Source')
        self.tr.column('#1', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#2', text='Description')
        self.tr.column('#2', minwidth=0, width=200, stretch=NO)
        self.tr.heading('#3', text='Update')
        self.tr.column('#3', minwidth=0, width=60, stretch=NO)
        self.tr.heading('#4', text='Delete')
        self.tr.column('#4', minwidth=0, width=60, stretch=NO)

        j = 0
        for i in db.db.show_income():
            self.tr.insert('',
                           index=j,
                           text=i[2],
                           values=(i[0], i[1], 'Update', 'Delete'))
            j += 1

        # Create action on selected row
        self.tr.bind('<Double-Button-1>', self.actions)

        # Position the table on the frame
        self.tr.place(x=50, y=y + 50)

        self.win.mainloop()

    def actions(self, e):
        # Get the value of the selected row
        tt = self.tr.focus()

        # Get the column id
        col = self.tr.identify_column(e.x)
        print(compile)
        print(self.tr.item(tt))

        tup = (self.tr.item(tt).get('text'), )

        if col == '#4':
            res = messagebox.askyesno("Message",
                                      "Are you sure you want to delete?")
            if res:
                rs = db.db.delete_income(tup)
                if rs:
                    messagebox.showinfo("Message", "Data has been deleted.")
                    self.win.destroy()
                    z = ShowWindow()
                    z.add_frame()
            else:
                self.win.destroy()
                z = ShowWindow()
                z.add_frame()

        if col == '#3':
            res = income.add_income.IncomeWindow(self.tr.item(tt))
            self.win.destroy()
            res.add_frame()
class window:
    def __init__(self):

        self.win = Tk()
        height = self.win.winfo_screenheight()
        width = self.win.winfo_screenwidth()
        x = (width - 700) // 2
        y = (height - 700) // 2
        self.win.geometry('700x700+{}+{}'.format(str(x), str(y)))
        self.win.resizable(width=False, height=False)

        self.frame = Frame(self.win, height=700, width=700, bg="#a3c2c2")
        self.frame.place(x=0, y=0)

        self.frame1 = Frame(self.frame, bg="#e0ebeb", height=700, width=2)
        self.frame1.place(x=30, y=0)
        self.frame1 = Frame(self.frame, bg="#75a3a3", height=700, width=4)
        self.frame1.place(x=20, y=0)
        self.frame1 = Frame(self.frame, bg="#476b6b", height=700, width=6)
        self.frame1.place(x=10, y=0)

        self.frame1 = Frame(self.frame, bg="#e0ebeb", height=2, width=700)
        self.frame1.place(x=0, y=30)
        self.frame1 = Frame(self.frame, bg="#75a3a3", height=4, width=700)
        self.frame1.place(x=0, y=20)
        self.frame1 = Frame(self.frame, bg="#476b6b", height=6, width=700)
        self.frame1.place(x=0, y=10)

        self.table = Treeview(self.frame,
                              column=("#0", "#1", "#2", "#3", "#4", "#5", "#6",
                                      "#7"))
        style = ttk.Style()
        style.theme_use("alt")
        ttk.Style().configure("Treeview.Heading", font=('', 14, "bold"))

        self.table.column("#0", width=80)
        self.table.column("#1", width=80)
        self.table.column("#2", width=80)
        self.table.column("#3", width=80)
        self.table.column("#4", width=80)
        self.table.column("#5", width=80)
        self.table.column("#6", width=80)
        self.table.column("#7", width=80)

        self.table.heading("#0", text="Sr.")
        self.table.heading("#1", text="Name")
        self.table.heading("#2", text="Gender")
        self.table.heading("#3", text="Email")
        self.table.heading("#4", text="Contact")
        self.table.heading("#5", text="Address")
        self.table.heading("#6", text="Edit")
        self.table.heading("#7", text="Delete")

        x = database_queries.database()
        res = x.view_receptionist()
        #print(res)
        for i in res:
            self.table.insert('',
                              'end',
                              text=i[0],
                              value=(i[1], i[2], i[3], i[5], i[6], "edit",
                                     "delete"))

        self.table.bind("<Double Button-1>", self.trigger)
        self.table.place(x=40, y=50, width=640)

        self.win.mainloop()

    def trigger(self, e):
        row = self.table.focus()
        t = (self.table.item(row))
        col = self.table.identify_column(e.x)
        if col == "#6":
            y = edit_receptionist.window(t["text"])

            print("edit")
        elif (col == "#7"):
            o = database_queries.database()
            o.delete(t["text"])
Exemple #20
0
class MainWindow:
    """
    Класс главного окна
    """
    def __init__(self, top=None):
        """
        Создание всех элементов окна
        """

        top.geometry("1200x570+120+20")
        top.title("Football Analyser")
        top.configure(background=config.background_color)
        top.configure(highlightbackground=config.background_color)
        top.configure(highlightcolor="black")

        self.tree_view = Treeview(top, show="headings")

        self.first_name_label = Label(top)
        self.last_name_label = Label(top)
        self.country_label = Label(top)
        self.age_label = Label(top)
        self.plays_label = Label(top)
        self.goals_label = Label(top)

        self.first_name_entry = Entry(top)
        self.last_name_entry = Entry(top)
        self.country_entry = Entry(top)
        self.age_entry = Entry(top)
        self.plays_entry = Entry(top)
        self.goals_entry = Entry(top)

        self.entries_list = [
            self.first_name_entry, self.last_name_entry, self.country_entry,
            self.age_entry, self.plays_entry, self.goals_entry
        ]

        self.add_button = Button(top)
        self.delete_button = Button(top)
        self.modify_button = Button(top)
        self.clear_fields_button = Button(top)
        self.analyze_button = Button(top)

        self.configure_tree_view()\
            .configure_labels()\
            .configure_entries()\
            .configure_buttons()\
            .fill_on_start()

    def configure_tree_view(self):
        """
        Настройка treeview для отображения всех записей
        """

        self.tree_view.place(relx=0.008,
                             rely=0.018,
                             relheight=0.837,
                             relwidth=0.754)

        self.tree_view["columns"] = ("First name", "Last name", "Country",
                                     "Age", "Plays", "Goals")

        self.tree_view.column("First name", width=200)
        self.tree_view.column("Last name", width=200)
        self.tree_view.column("Country", width=100)
        self.tree_view.column("Age", width=100)
        self.tree_view.column("Plays", width=100)
        self.tree_view.column("Goals", width=100)

        self.tree_view.heading("First name", text="First name")
        self.tree_view.heading("Last name", text="Last name")
        self.tree_view.heading("Country", text="Country")
        self.tree_view.heading("Age", text="Age")
        self.tree_view.heading("Plays", text="Plays")
        self.tree_view.heading("Goals", text="Goals")

        self.tree_view.bind("<<TreeviewSelect>>",
                            lambda event: self.on_select_item())

        return self

    def configure_labels(self):
        """
        Настройка текста над полями ввода
        """

        self.first_name_label.place(relx=0.775, rely=0.07, height=26, width=74)
        self.first_name_label.configure(background=config.background_color)
        self.first_name_label.configure(text="First name")

        self.last_name_label.place(relx=0.775, rely=0.193, height=26, width=73)
        self.last_name_label.configure(background=config.background_color)
        self.last_name_label.configure(text="Last name")

        self.country_label.place(relx=0.775, rely=0.316, height=26, width=57)
        self.country_label.configure(background=config.background_color)
        self.country_label.configure(text="Country")

        self.age_label.place(relx=0.775, rely=0.439, height=26, width=33)
        self.age_label.configure(background=config.background_color)
        self.age_label.configure(text="Age")

        self.plays_label.place(relx=0.775, rely=0.561, height=26, width=39)
        self.plays_label.configure(background=config.background_color)
        self.plays_label.configure(text="Plays")

        self.goals_label.place(relx=0.775, rely=0.684, height=26, width=43)
        self.goals_label.configure(background=config.background_color)
        self.goals_label.configure(text="Goals")

        return self

    def configure_entries(self):
        """
        Настройка полей ввода
        """

        self.first_name_entry.place(relx=0.775,
                                    rely=0.123,
                                    height=24,
                                    relwidth=0.17)
        self.first_name_entry.configure(font=config.font)

        self.last_name_entry.place(relx=0.775,
                                   rely=0.246,
                                   height=24,
                                   relwidth=0.17)
        self.last_name_entry.configure(font=config.font)

        self.country_entry.place(relx=0.775,
                                 rely=0.368,
                                 height=24,
                                 relwidth=0.17)
        self.country_entry.configure(font=config.font)

        self.age_entry.place(relx=0.775, rely=0.491, height=24, relwidth=0.17)
        self.age_entry.configure(font=config.font)

        self.plays_entry.place(relx=0.775,
                               rely=0.614,
                               height=24,
                               relwidth=0.17)
        self.plays_entry.configure(font=config.font)

        self.goals_entry.place(relx=0.775,
                               rely=0.737,
                               height=24,
                               relwidth=0.17)
        self.goals_entry.configure(font=config.font)

        return self

    def configure_buttons(self):
        """
        Настройка кнопок
        """

        self.add_button.place(relx=0.792, rely=0.807, height=33, width=40)
        self.add_button.configure(background=config.background_color)
        self.add_button.configure(text="Add")
        self.add_button.configure(command=self.add_item)

        self.delete_button.place(relx=0.9, rely=0.807, height=33, width=56)
        self.delete_button.configure(background=config.background_color)
        self.delete_button.configure(text="Delete")
        self.delete_button.configure(command=self.delete_item)

        self.modify_button.place(relx=0.842, rely=0.807, height=33, width=59)
        self.modify_button.configure(background=config.background_color)
        self.modify_button.configure(text="Modify")
        self.modify_button.configure(command=self.modify_item)

        self.clear_fields_button.place(relx=0.8,
                                       rely=0.895,
                                       height=33,
                                       width=166)
        self.clear_fields_button.configure(background=config.background_color)
        self.clear_fields_button.configure(text="Clear fields")
        self.clear_fields_button.configure(command=self.clear_all_entries)

        self.analyze_button.place(relx=0.225, rely=0.877, height=53, width=336)
        self.analyze_button.configure(background=config.background_color)
        self.analyze_button.configure(text="Analyze")
        self.analyze_button.configure(font="-size 18")
        self.analyze_button.configure(command=self.analyze)

        return self

    def fill_on_start(self):
        """
        Заполнение treeview записями из базы данных
        """

        for row in db.get_records():
            self.tree_view.insert("", tk.END, values=row)
        return self

    def on_select_item(self):
        """
        Отображение выбранной записи в полях ввода для редактирования
        """

        values = self.tree_view.item(self.tree_view.focus())["values"]
        for entry, val in zip(self.entries_list, values):
            entry.delete(0, tk.END)
            entry.insert(0, val)

    def clear_all_entries(self):
        """
        Очистка всех полей ввода
        """

        for entry in self.entries_list:
            entry.delete(0, tk.END)

    def delete_item(self):
        """
        Удаление записи
        """

        item = self.tree_view.focus()
        db.delete_record(self.tree_view.index(item))
        self.tree_view.delete(item)
        self.clear_all_entries()

    def add_item(self):
        """
        Добавление записи
        """

        try:
            first_name = validator.validate_text(self.first_name_entry.get())
            last_name = validator.validate_text(self.last_name_entry.get())
            country = validator.validate_text(self.country_entry.get())
            age = validator.validate_number(self.age_entry.get())
            plays = validator.validate_number(self.plays_entry.get())
            goals = validator.validate_number(self.goals_entry.get())

            db.insert_record({
                "first_name": first_name,
                "last_name": last_name,
                "country": country,
                "age": age,
                "plays": plays,
                "goals": goals
            })
            self.tree_view.insert("",
                                  tk.END,
                                  values=(first_name, last_name, country, age,
                                          plays, goals))

        except ValueError:
            messagebox.showerror("Invalid input",
                                 "Input are not valid string or number")

        self.on_select_item()

    def modify_item(self):
        """
        Изменение записи
        """

        try:
            item = self.tree_view.focus()
            index = self.tree_view.index(item)

            first_name = validator.validate_text(self.first_name_entry.get())
            last_name = validator.validate_text(self.last_name_entry.get())
            country = validator.validate_text(self.country_entry.get())
            age = validator.validate_number(self.age_entry.get())
            plays = validator.validate_number(self.plays_entry.get())
            goals = validator.validate_number(self.goals_entry.get())

            db.update_record(
                index, (first_name, last_name, country, age, plays, goals))
            self.tree_view.item(item,
                                values=(first_name, last_name, country, age,
                                        plays, goals))

        except ValueError:
            messagebox.showerror("Invalid input",
                                 "Input are not valid string or number")

        self.on_select_item()

    def analyze(self):
        """
        Вызов анализа
        """

        analyse.full_analysis()
        messagebox.showinfo("Done",
                            "Файлы отчета сохранены в output и graphics")
class showIncome:
    def __init__(self):
        self.win=Tk()
        self.canvas = Canvas(self.win, width=800, height=450, bg="white")
        self.canvas.pack(expand=YES, fill=BOTH)

        # bringing the screen in the centre
        width = self.win.winfo_screenwidth()
        height = self.win.winfo_screenheight()
        x = int(width / 2 - 800 / 2)
        y = int(height / 2 - 450 / 2)
        strl = "800x450+" + str(x) + "+" + str(y)
        self.win.geometry(strl)

        # disable resize of the window

        self.win.resizable(width=False, height=False)

        # change the title of the window
        self.win.title("WELCOME | Show income | ADMINISTRATOR")

    def add_frame(self):
        self.frame=Frame(self.win, width=600, height=350)
        self.frame.place(x=100, y=20)
        x, y= 70,20
        # using treeview to show the table
        # mention number of columns
        self.tr=Treeview(self.frame, columns=('A','B','C','D'), selectmode="extended")
        # heading key+text
        self.tr.heading('#0', text='Sr no')
        self.tr.column('#0', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#1', text='Source')
        self.tr.column('#1', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#2', text='Income')
        self.tr.column('#2', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#3', text='Update')
        self.tr.column('#3', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#4', text='Delete')
        self.tr.column('#4', minwidth=0, width=100, stretch=NO)

        j=0
        for i in db.db.show_income():
            self.tr.insert('', index=j, text=i[0], values=(i[1], i[2], 'Update', 'Delete'))
            j+=1

        # create an action on selected row
        self.tr.bind('<Double-Button-1>', self.actions)
        self.tr.place(x=50, y=y+50)
        self.win.mainloop()
    def actions(self,e):
       # get the value of selected row
       tt=self.tr.focus()

       # get the column id
       col=self.tr.identify_column(e.x)
       print(col)

       print(self.tr.item(tt))
       tup=(
           self.tr.item(tt).get('text'),
       )
       if col=='#4':
           res=messagebox.askyesno("Message","Do you want to delete?")
           if res:
               rs=db.db.delete_income(tup)
               if rs:
                   messagebox.showinfo("Message","Message deleted")
                   self.win.destroy()
                   z=showIncome()
                   z.add_frame()
               else:
                   self.win.destroy()
                   z=showIncome()
                   z.add_frame()
       elif col=='#3':
           res=income.addIncome.IncomeWindow(self.tr.item(tt))
           self.win.destroy()
           res.add_frame()
    def customer_analysis():
        print(phno2.get())

        def get_selected_date(selection):
            selected_date = selection
            print(selected_date)

        rootan = Tk()
        rootan.geometry("940x610+100+50")
        rootan.title("Customer Analysis")
        rootan.config(bg="#4fc3f7")
        selected_date = StringVar(rootan)

        x = []
        y = []
        a = []
        b = []

        analysislabel = Label(rootan,
                              text="Customer Analysis",
                              font=("Lobster Two", 20, "bold"),
                              fg="#ffffff",
                              bg="#4fc3f7")
        analysislabel.pack()

        g1 = con.cursor()
        g1.execute(
            "select pcategory as purchased from inventory,sales where inventory.pid = sales.pid and cmobnum = ? GROUP by pcategory;",
            (phno2.get(), ))
        fetch = g1.fetchall()

        for data in fetch:
            x.extend(data)

        g2 = con.cursor()
        g2.execute(
            "select count(sales.pid) as purchased from inventory,sales where inventory.pid = sales.pid and cmobnum = ? GROUP by pcategory;",
            (phno2.get(), ))
        fet = g2.fetchall()

        for dat in fet:
            y.extend(dat)

        fig = Figure(figsize=(5, 3), dpi=80)
        fig.suptitle('Category - wise', fontsize=16)
        axes = fig.add_subplot(111)
        axes.plot(x, y)

        canvas = FigureCanvasTkAgg(fig, rootan)
        canvas.get_tk_widget().place(x=20, y=350)
        fig.set_facecolor("#81d4fa")

        c = con.cursor()
        top = c.execute(
            "select pname,pcategory,count(pname) from inventory,sales where inventory.pid = sales.pid and cmobnum = ? group by pname order by count(pname) DESC LIMIT 5;",
            (phno2.get(), ))
        fetc = c.fetchall()

        top5 = Label(rootan,
                     text="Most recently bought :",
                     font=("Oxygen", 16, "bold"),
                     fg="#212121",
                     bg="#4fc3f7")
        top5.place(x=650, y=100)

        tree = Treeview(rootan, columns=('pname', 'pcategory', 'count(pname)'))
        tree.heading('pname', text='Product Name')
        tree.heading('pcategory', text='Category')
        tree.heading('count(pname)', text='Purchased count')
        tree.column("pname", width=90)
        tree.column("pcategory", width=90)
        tree.column("count(pname)", width=90)
        tree.place(x=650, y=150)
        tree['show'] = 'headings'

        for data in fetc:
            tree.insert('', 'end', values=(data))

        options = []

        d = con.cursor()
        d.execute("select distinct(date) from sales;")
        val = d.fetchall()

        for data in val:
            options.extend(data)

        selected_date.set(options[1])

        p = con.cursor()
        p.execute(
            """select sum(pprice) from inventory,sales where sales.pid = inventory.pid and cmobnum = ? group by strftime("%m",date) order by strftime("%m",date)""",
            (phno2.get(), ))
        fetc = p.fetchall()

        i = con.cursor()
        i.execute(
            """select distinct  strftime("%m",date) as month from sales order by month;"""
        )
        fet = i.fetchall()

        for dat in fetc:
            a.extend(dat)

        for data in fet:
            b.extend(data)

        fig2 = Figure(figsize=(5, 3), dpi=80)
        fig2.suptitle('Monthly Spendings', fontsize=16)
        axes2 = fig2.add_subplot(111)
        axes2.plot(b, a)

        canvas2 = FigureCanvasTkAgg(fig2, rootan)
        canvas2.get_tk_widget().place(x=20, y=80)
        fig2.set_facecolor("#81d4fa")

        outbtn = Button(rootan,
                        text="Back",
                        font=("Noto sans", 12, "bold"),
                        fg="#ffffff",
                        bg="#c62828",
                        relief="flat",
                        command=rootan.destroy)
        outbtn.place(x=830, y=5)

        rootan.mainloop()
Exemple #23
0
                     text='Étudiant',
                     width=650,
                     height=645,
                     bd=2,
                     bg='#C4DCCE',
                     font=('bold', 20)).place(x=14, y=102)
sub_frameEt = LabelFrame(FrameEt,
                         width=632,
                         height=556,
                         bd=2,
                         font=('bold', 20)).place(x=23, y=130)
tv_et = Treeview(sub_frameEt,
                 columns=(1, 2, 3, 4, 5),
                 show='headings',
                 height=12)
tv_et.place(x=56, y=400)

tv_et.heading(1, text='id étudinat')
tv_et.column(1, anchor='center', width=90)

tv_et.heading(2, text='nom')
tv_et.column(2, anchor='center', width=120)

tv_et.heading(3, text='prénom')
tv_et.column(3, anchor='center', width=120)

tv_et.heading(4, text='age')
tv_et.column(4, anchor='center', width=95)

tv_et.heading(5, text='filière')
tv_et.column(5, anchor='center', width=125)
Exemple #24
0
class App_test(object):
    def __init__(self, master, fuc, query, next, pre):
        self.win = master
        self.win.title('笔趣阁阅读_v1.0   by: 孤月')
        self.win.iconbitmap('./ico/gui_text_proce.ico')  # 指定界面图标
        curWidth = self.win.winfo_width()
        curHeight = self.win.winfo_height()
        scnWidth, scnHeight = self.win.maxsize()
        tmpcnf = '1340x640+500+300'  # % ((scnWidth - curWidth) / 2, (scnHeight - curHeight) / 2)
        self.win.geometry(tmpcnf)
        self.creat_res()
        self.set_position()
        self.add_train_info()
        self.res_config(fuc, query, next, pre)
        self.train_message = {}
        self.gettime()  # 系统时间

    def creat_res(self):
        self.v = IntVar()  # 书籍查询
        self.v.set(True)
        self.temp = StringVar()  # 书名/作者 录入
        self.temp2 = StringVar()  # 章节名录入
        self.sys_time = StringVar()  # 系统时间

        self.E_startstation = Entry(self.win, textvariable=self.temp)
        self.E_endstation = Entry(self.win, textvariable=self.temp2)

        self.La_startstation = Label(self.win, text="根据书名/作者搜索:")
        self.La_endstation = Label(self.win, text="根据章节名搜索:")
        self.La_directory = Label(self.win, text="目录")
        self.La_text = Label(self.win, text="正文")
        self.La_sys_time = Label(self.win, textvariable=self.sys_time, fg='blue', font=("黑体", 20))  # 设置字体大小颜色

        self.B_search = Button(self.win, text="搜索")
        self.B_buy_tick = Button(self.win, text="阅读")
        self.B_pre_chapter = Button(self.win, text="上一章")
        self.B_next_chapter = Button(self.win, text="下一章")

        self.R_site = Radiobutton(self.win, text="书名查询", variable=self.v, value=True)
        self.R_price = Radiobutton(self.win, text="章节查询", variable=self.v, value=False)

        self.init_data_Text = Text(self.win)  # 原始数据录入框
        self.S_move = Scrollbar(self.win)  # 目录滚动条
        self.S_text_move = Scrollbar(self.win)  # 创建文本框滚动条

    # 设置位置
    def set_position(self):
        self.init_data_Text.place(x=430, y=40, width=870, height=550)
        self.E_startstation.place(x=10, y=50, width=145, height=30)
        self.E_startstation.insert(10, "星辰变")
        self.E_endstation.place(x=10, y=140, width=145, height=30)
        self.E_endstation.insert(10, "第一章 秦羽")
        self.La_startstation.place(x=10, y=10, width=130, height=30)
        self.La_endstation.place(x=10, y=100, width=120, height=30)
        self.La_sys_time.place(x=1150, y=600, width=160, height=30)
        self.B_search.place(x=10, y=220, width=80, height=40)
        self.B_pre_chapter.place(x=950, y=600, width=80, height=40)
        self.B_next_chapter.place(x=1050, y=600, width=80, height=40)
        self.S_move.place(x=380, y=40, width=30, height=550)
        self.S_text_move.place(x=1300, y=40, width=30, height=550)
        self.B_buy_tick.place(x=90, y=220, width=80, height=40)
        self.R_site.place(x=10, y=180, width=90, height=30)
        self.R_price.place(x=100, y=180, width=90, height=30)
        self.La_directory.place(x=180, y=7, width=90, height=30)
        self.La_text.place(x=420, y=7, width=70, height=30)

    # 为按钮绑定事件
    def res_config(self, fuc, query, next_, pre):
        self.B_search.config(command=fuc)  # 搜索
        self.B_buy_tick.config(command=query)  # 阅读
        self.B_pre_chapter.config(command=pre)  # 上一章
        self.B_next_chapter.config(command=next_)  # 下一章
        self.S_move.config(command=self.tree.yview)  # 目录滚动条
        self.tree.config(yscrollcommand=self.S_move.set)
        self.S_text_move.config(command=self.init_data_Text.yview)  # 文本框滚动条
        self.init_data_Text.config(yscrollcommand=self.S_text_move.set)

    def add_train_info(self):
        lis_train = ["C" + str(x) for x in range(0, 2)]
        tuple_train = tuple(lis_train)
        self.tree = Treeview(self.win, columns=tuple_train, height=30, show="headings")
        self.tree.place(x=200, y=40, width=180, height=550)
        train_info = [' 书名 ', ' 作者 ']
        for i in range(0, len(lis_train)):
            self.tree.column(lis_train[i], width=len(train_info[i]) * 11,
                             anchor='w')  # must be n, ne, e, se, s, sw, w, nw, or center
            self.tree.heading(lis_train[i], text=train_info[i])

    # 实时显示时钟
    def gettime(self):
        # 获取当前时间
        self.sys_time.set(time.strftime("%H:%M:%S"))
        # 每隔一秒调用函数自身获取时间
        self.win.after(1000, self.gettime)
Exemple #25
0
class main():
    def __init__(self, tk):

        self.frame_lgn = Frame(lgn_Screen, width=450, height=750)
        self.frame_lgn.pack()

        #Separator
        self.pane_W = LabelFrame(lgn_Screen,
                                 text='Your Credentials',
                                 width=300,
                                 height=200)
        self.pane_W.place(x=1, y=10)

        #Login Entry
        self.usr_label = Label(lgn_Screen, text="Usuário:")
        self.usr_label.place(x=22, y=53)
        self.usr_entry = Entry(lgn_Screen, width=25)
        self.usr_entry.place(x=72, y=50)
        #Passowrd Entry
        self.pw_label = Label(lgn_Screen, text="Senha:")
        self.pw_label.place(x=30, y=103)
        self.pw_entry = Entry(lgn_Screen, show="*", width=25)
        self.pw_entry.place(x=72, y=100)

        def validate():
            usr = str(self.usr_entry.get())
            pw = str(self.pw_entry.get())

            print(usr)
            print(pw)

        #Separator message
        self.pane_W_Text = LabelFrame(lgn_Screen,
                                      text='Your Message:',
                                      width=300,
                                      height=200)
        self.pane_W_Text.place(x=1, y=210)
        #textbox
        self.tb = Text(lgn_Screen, width=35, height=8, borderwidth=0)
        self.tb.place(x=7, y=225)

        #Separator data
        self.pane_groups = LabelFrame(lgn_Screen,
                                      text='Seus Grupos aparecerão aqui:',
                                      width=300,
                                      height=200)
        self.pane_groups.place(x=1, y=410)

        self.tvGroups = Treeview(lgn_Screen)
        self.tvGroups.place(x=7, y=425, width=287, height=130)

        #Aviso de Botão
        fontStyle = tkFont.Font(size=8)
        self.advcLbl = Label(
            lgn_Screen,
            text=
            "* Aviso: o botão para confirmar o grupo será \nliberado em breve!",
            font=fontStyle)
        self.advcLbl.place(x=7, y=610)

        def conf_Message():
            msg = str(self.tb.get('1.0', 'end-1c'))
            print(msg)
            from selenium import webdriver
            from time import sleep
            from selenium.webdriver.common.keys import Keys

            url = "https://facebook.com/"
            d = webdriver.Chrome()
            d.get(url)

            sleep(2)

            target_user = d.find_element_by_xpath('//*[@id="email"]')
            target_pw = d.find_element_by_xpath('//*[@id="pass"]')
            target_user.click()
            sleep(2)
            target_user.send_keys(str(self.usr_entry.get()))
            sleep(2)
            target_pw.send_keys(str(self.pw_entry.get()))
            sleep(6)
            log_in = d.find_element_by_xpath('//*[@id="u_0_b"]')
            sleep(1)
            log_in.click()
            sleep(3)
            webdriver.ActionChains(d).send_keys(Keys.ESCAPE).perform()
            sleep(4)
            explore_Group = d.find_element_by_xpath(
                '//*[@id="navItem_1434659290104689"]/a/div')
            explore_Group.click()
            sleep(3)
            webdriver.ActionChains(d).send_keys(Keys.ESCAPE).perform()
            sleep(1)
            try:
                while True:
                    see_more = d.find_element_by_xpath(
                        "//*[contains(text(), 'Ver mais')]")
                    see_more.click()
                    sleep(2)
            except:
                pass
            sleep(3)
            groups = d.find_elements_by_class_name('_2yaa')
            l_groups = []
            for g_names in groups:
                l_groups.append(str(g_names.text))

            print(l_groups)
            group_index = []
            counter = 0
            for j in l_groups[:-1]:
                if str(j) == 'Descobrir':
                    continue
                print(str(counter) + " - " + str(j))
                counter += 1
                self.tvGroups.insert('', 'end', text=j)

            #selected_Group = ""
            def confirmGroup():
                self.cur = self.tvGroups.focus()
                self.selectedItem = str(self.tvGroups.item(self.cur)['text'])
                print(self.selectedItem)

                openGroup = d.find_element_by_xpath("//*[contains(text(), '" +
                                                    self.selectedItem + "')]")
                openGroup.click()
                sleep(6)
                postit = d.find_element_by_xpath(
                    "//*[@name='xhpc_message_text']")
                postit.send_keys(str(self.tb.get('1.0', 'end-1c')))
                sleep(5)
                publish = d.find_element_by_class_name('_332r')
                publish.click()

            self.selgroup = Button(lgn_Screen,
                                   text="Confirmar",
                                   width=10,
                                   font='Verdana 8',
                                   borderwidth=0,
                                   bg='#FFFFFF',
                                   fg='#363636',
                                   command=confirmGroup)
            self.selgroup.place(x=175, y=570)

        self.cnf_Msg = Button(lgn_Screen,
                              text="Confirmar",
                              width=10,
                              font='Verdana 8',
                              borderwidth=0,
                              bg='#FFFFFF',
                              fg='#363636',
                              command=conf_Message)
        self.cnf_Msg.place(x=175, y=370, height=20)
Exemple #26
0
class main:
    def __init__(self):
        self.tk = Toplevel()
        height = self.tk.winfo_screenheight()
        width = self.tk.winfo_screenwidth()

        y = (height - 650) // 2
        x = (width - 650) // 2
        self.tk.geometry('650x650+' + str(x) + '+' + str(y))

        self.tk.resizable(height=False, width=False)
        self.tk.title("manage patient")

        self.f = Frame(self.tk, height="650", width="650", bg="#CEE3F6")
        self.f.place(x=0, y=0)

        self.f1 = Frame(self.f, height="100", width="650", bg="#070719")
        self.f1.place(x=0, y=0)

        self.l = Label(self.f1,
                       text="Manage Patient",
                       font=('cooper black', 35),
                       fg="#CEE3F6",
                       bg="#070719")
        self.l.place(x=150, y=20)

        self.fr = Frame(self.f, height="70", width="650", bg="#070719")
        self.fr.place(x=0, y=580)
        self.fr1 = Frame(self.f, height="10", width="650", bg="#070719")
        self.fr1.place(x=0, y=560)

        self.table = Treeview(self.f,
                              column=("#0", "#1", "#2", "#3", "#4", "#5", "#6",
                                      "#7", "#8", "#9"))
        style = ttk.Style()
        style.theme_use("alt")
        ttk.Style().configure("Treeview.heading", font=('', 30))
        self.table.heading("#0", text="sno")
        self.table.column("#0", width="30")
        self.table.heading("#1", text="Name")
        self.table.column("#1", width="60")
        self.table.heading("#2", text="Gender")
        self.table.column("#2", width="60")
        self.table.heading("#3", text="Age")
        self.table.column("#3", width="60")
        self.table.heading("#4", text="contact")
        self.table.column("#4", width="70")
        self.table.heading("#5", text="Address")
        self.table.column("#5", width="70")
        self.table.heading("#6", text="Email")
        self.table.column("#6", width="90")
        self.table.heading("#7", text="History")
        self.table.column("#7", width="70")

        self.table.heading("#8", text="Edit")
        self.table.column("#8", width="70")
        self.table.heading("#9", text="Delete")
        self.table.column("#9", width="70")
        self.table.place(x=0, y=200)

        s = database_queries.database()
        res = s.view_patient()
        print(res)
        for i in res:

            self.table.insert('',
                              'end',
                              text=i[0],
                              value=(i[1], i[2], i[3], i[4], i[5], i[6],
                                     "History", "Edit", "Delete"))
            self.table.bind("<Double Button>", self.trigger)
            self.table.place()

        self.tk.mainloop()

    def trigger(self, e):
        #print(e)
        d = self.table.focus()
        g = (self.table.item(d))
        col = self.table.identify_column(e.x)
        if col == "#8":
            y = editp.main(g["text"])
            print("edit")

        elif col == "#9":
            print("delete")
            f = del_appoint()
Exemple #27
0
class FacultyDelWindow:
    def __init__(self, data=''):
        self.data = data
        print(self.data)
        self.win = Tk()
        self.canvas = Canvas(self.win, width=800, height=420, bg='white')
        self.canvas.pack(expand=YES, fill=BOTH)

        # show window in center of the screen
        width = self.win.winfo_screenwidth()
        height = self.win.winfo_screenheight()
        x = int(width / 2 - 800 / 2)
        y = int(height / 2 - 420 / 2)
        str1 = "800x420+" + str(x) + "+" + str(y)
        self.win.geometry(str1)

        # disable resize window
        self.win.resizable(False, False)

        # changing title of the window
        self.win.title(
            "| DELETING FACULTY DETAILS | LIBRARY MANAGEMENT SYSTEM |")

    def add_frame(self):

        self.frame = Frame(self.win, height=420, width=800)
        self.frame.place(x=0, y=0)

        x, y = 0, 0

        self.label = Label(self.frame,
                           text="DELETING FACULTY DETAILS",
                           fg='black')
        self.label.config(font=("Poppins", 20, 'underline bold'))
        self.label.place(x=190, y=35)

        # use tree view to show details from the table
        self.tr = Treeview(self.frame,
                           columns=('FACULTY_ID', 'FACULTY_NAME', 'GENDER',
                                    'DEPARTMENT', 'CONTACT_NO'),
                           selectmode="extended")

        # heading key + text

        self.tr.heading('#0', text='FACULTY_ID')
        self.tr.column('#0', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#1', text='FACULTY_NAME')
        self.tr.column('#1', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#2', text='GENDER')
        self.tr.column('#2', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#3', text='DEPARTMENT')
        self.tr.column('#3', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#4', text='CONTACT_NO')
        self.tr.column('#4', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#5', text='DELETE')
        self.tr.column('#5', minwidth=0, width=100, stretch=NO)
        # self.tr.heading('#6', text='DELETE')
        # self.tr.column('#6', minwidth=0, width=100, stretch=NO)

        j = 0
        for i in Database.database.Faculties():
            self.tr.insert('',
                           index=j,
                           text=i[0],
                           values=(i[1], i[2], i[3], i[4], 'DELETE'))
            j += 1

        # create action on deletion
        self.tr.bind('<Double-Button-1>', self.actions)
        self.tr.place(x=100, y=y + 100)

        self.win.mainloop()

    def actions(self, e):
        # get the value of deleted row
        tt = self.tr.focus()

        # get the column id
        col = self.tr.identify_column(e.x)
        print(col)
        print(self.tr.item(tt))

        data = (self.tr.item(tt).get('text'), )

        if col == '#5':
            res = messagebox.askyesno("Message", "Do you want  to delete..!")
            if res:
                d = Database.database.DeleteFaculty(data)
                if d:
                    messagebox.showinfo(
                        "Message", "Faculty Details deleted successfully..!")
                    self.win.destroy()
                    x = Thirdpage
            else:
                self.win.destroy()
                x = Student.DeleteFaculty.FacultyDelWindow()
                x.add_frame()
Exemple #28
0
    root.resizable(0, 0)
    root.title("Station3.v1.web-server")

    tree = Treeview(root)
    tree["columns"] = ('Percent', 'Status', 'Start', 'End')

    tree.column("#0", width=200, minwidth=150, stretch=NO)
    tree.column("Status", width=100, minwidth=80, stretch=NO)
    tree.column("Percent", width=300, minwidth=80, stretch=NO)
    tree.column("Start", width=220, minwidth=80, stretch=NO)
    tree.column("End", width=220, minwidth=80, stretch=NO)

    tree.heading('#0', text='MAC')
    tree.heading('Status', text='Status')
    tree.heading('Percent', text='Percent')
    tree.heading('Start', text='Start Time')
    tree.heading('End', text='End Time')

    tree.place(x=150, y=50)
    # progress.place(x=10, y=300)
    Button(root, text='Discover Device', command=show_discovered,
           width=14).place(x=19, y=50)
    Button(root, text='Start Provision', command=device_provisioning,
           width=14).place(x=19, y=111)
    Button(root, text='Start Locking', command=start_locking,
           width=14).place(x=19, y=178)
    Button(root, text='Delete Device', command=delete_device,
           width=14).place(x=19, y=242)
    Button(root, text='Exit', command=close_window).place(x=600, y=300)
    mainloop()
Exemple #29
0
class show:
    def __init__(self):
        self.window=Tk()
        self.window.title("Show | Sales Products")
        self.window.iconbitmap('shop.ico')
        self.window.geometry("1365x670+0+0")
        self.window.maxsize(1365,670)
        self.window.minsize(1365,670)
        # self.window.resizable(width=False,height=False)
    def add_background(self):
        self.image = Image.open("images/back.jpg")
        self.image = self.image.resize((1365, 700), Image.ANTIALIAS)
        self.img = ImageTk.PhotoImage(self.image)
        self.li = Label(image = self.img, text="TALHA")
        self.li.image = self.img
        self.li.pack()
        self.Menubar()

    def Menubar(self):
        self.menubar = Menu()
        self.menuitems_add = Menu(self.menubar, tearoff=0,bg="blue",fg="white")
        self.menuitems_add.add_command(label="Add Products", command=self.add_products)
        # self.menuitems.add_separator()

        self.menuitems_sales = Menu(self.menubar, tearoff=0,bg="blue",fg="white")
        self.menuitems_sales.add_command(label="Sale Products", command=self.sales_products)

        self.menuitems_customer = Menu(self.menubar, tearoff=0, bg="blue", fg="white")
        self.menuitems_customer.add_command(label="Add Customer", command=self.add_customer)
        self.menuitems_customer.add_command(label="Show Customer Records", command=self.customer_record)

        self.menuitems_reports = Menu(self.menubar, tearoff=0, bg="blue", fg="white")
        self.menuitems_reports.add_command(label="Check Products Quantity", command=self.check_products_quantity)
        self.menuitems_reports.add_command(label="Check Profit/Loss", command=self.check_profit_loss)
        self.menuitems_reports.add_command(label="Check Sales Products", command=self.check_products_sales)
        self.menuitems_reports.add_command(label="Check Sent Amount Details", command=self.check_amount)

        self.menubar.add_cascade(label="Add Products", menu=self.menuitems_add)
        self.menubar.add_cascade(label="Sales Products", menu=self.menuitems_sales)
        self.menubar.add_cascade(label="Customer", menu=self.menuitems_customer)
        self.menubar.add_cascade(label="Reports", menu=self.menuitems_reports)
        self.menubar.add_cascade(label="Exit", command=quit)
        self.window.config(menu=self.menubar)

    def add_table(self):
        self.l1=Label(self.window,text="**Sales Details**",font="Courier 25 bold",bg="black",fg="white",width=61)
        self.l1.place(x=82,y=20)

        self.l1 = Label(self.window, text="Developed by : Muhammad Talha | NTU", font="Courier 10 bold")
        self.l1.place(x=470, y=610)

        self.l1 = Label(self.window, text="Enter Product Name:", font="courier 16 bold",bg="blue",fg="white")
        self.l1.place(x=280, y=90)

        self.Entry_reg = Entry(self.window, font="courior 14 bold")
        self.Entry_reg.place(x=550, y=90, height=30)

        self.b1 = Button(self.window, text="Search", font="Times 13 bold",fg="white",bg="blue",width=10)
        self.b1.place(x=790, y=90)
        self.b1.bind('<Button-1>', self.search_product)


        # for Style Table
        style = Style()
        style.configure("mystyle.Treeview", highlightthickness=0, bd=0,
                        font=('courier 12 bold'),rowheight=43)  # Modify the font of the body
        style.configure("mystyle.Treeview.Heading", font=('Times 15 bold'),foreground="black")  # Modify the font of the headings
        # style.layout("mystyle.Treeview", [('mystyle.Treeview.treearea', {'sticky': 'nswe'})])  # Remove the borders
        # import TreeViewe
        self.tr=Treeview(self.window,columns=('A','B','C','D','E'),selectmode="extended",style='mystyle.Treeview')
        # heading key+text
        self.tr.heading("#0", text="Sr.No")
        self.tr.column("#0", minwidth=0, width=85, stretch=NO)

        self.tr.heading("#1",text="Product Name")
        self.tr.column("#1",minwidth=0,width=160,stretch=NO)

        self.tr.heading("#2", text="Product Catagory")
        self.tr.column("#2", minwidth=0, width=200, stretch=NO)

        self.tr.heading("#3", text="Quantity")
        self.tr.column("#3", minwidth=0, width=175, stretch=NO)

        self.tr.heading("#4", text="Price Per Product")
        self.tr.column("#4", minwidth=0, width=175, stretch=NO)

        self.tr.heading("#5", text="Sales Price")
        self.tr.column("#5", minwidth=0, width=160, stretch=NO)

        j=1
        for i in Database.show_sales_details():
            self.tr.insert('',index=j,text=j,values=(i[1],i[2],i[3],i[4],i[5]))
            j+=1

        self.Entry_reg.bind('<KeyRelease>', self.remove)

        self.sb = Scrollbar(self.tr)
        self.sb.place(x=935,y=2,height=452,width=22,bordermode=OUTSIDE)
        self.sb.config(command=self.tr.yview)
        self.tr.config(yscrollcommand=self.sb.set)
        self.tr.place(x=170,y=150)

        # to excel file
        self.b1 = Button(self.window, text="Save to Excel", font="Times 12 bold",bg="blue",fg="white",width=20,
        )
        self.b1.place(x=938, y=610)
        self.b1.bind('<Button-1>', self.excel)


        self.window.mainloop()


    def remove(self,event):
        for row in self.tr.get_children():
            self.tr.delete(row)
        j = 1
        for i in Database.show_sales_details():
            self.tr.insert('', index=j, text=j, values=(i[1], i[2], i[3], i[4], i[5]))
            j += 1

    def search_product(self,event):
        try:
            data = (self.Entry_reg.get(),)
            if self.Entry_reg.get() == "":
                msg.showwarning("Message ! ", "please insert product name !")
            else:
                j = 1
                D = Database.search_details_sales_table(data)
                if D:
                    for row in self.tr.get_children():
                        self.tr.delete(row)
                    self.Entry_reg.delete(0, END)
                    for i in D:
                        self.tr.insert('', index=j, text=j, values=(i[1],i[2],i[3],i[4],i[5]))
                        j += 1
                else:
                    msg.showwarning("Message!", "No result Found!")

        except:
            msg.showwarning("Error!", "Something went wrong! please contact with developer !!!")
    def excel(self,event):
        try:
            x=Database.show_sales_details()
            p_name=[]
            p_catagory=[]
            p_quantity=[]
            price=[]
            p_sales_price=[]
            for i in range(len(x)):
                z=x.__getitem__(i)
                p_name.append(z[1])
                p_catagory.append(z[2])
                p_quantity.append(z[3])
                price.append(z[4])
                p_sales_price.append(z[5])

            products = pd.DataFrame({
                "Product Name": p_name,
                "Product Catagory":p_catagory,
                "Quantity":p_quantity,
                "Price Per Product":price,
                "Sales Price":p_sales_price
            })

            with pd.ExcelWriter("Excel Files/Sales_Products_Records.xlsx") as writer:
                products.to_excel(writer, sheet_name="Sales_Products", index=False)
            msg.showinfo("Message ! ", "Your data has been inserted Susccessfully !")
        except:
            msg.showwarning("Message!","Something Went Wrong!please contact with developer!!!")

    def add_products(self):
        self.window.destroy()
        home = Home.data()
        home.add_background()
        home.add_frame()

    def sales_products(self):
        self.window.destroy()
        showP = Showing_Records.show()
        showP.add_background()
        showP.add_table()
    def check_products_quantity(self):
        self.window.destroy()
        showP = Check_Products_Quantity.show()
        showP.add_background()
        showP.add_table()
    def check_products_sales(self):
        pass

    def check_amount(self):
        self.window.destroy()
        showP = Check_Amount_Details.show()
        showP.add_background()
        showP.add_table()
    def check_profit_loss(self):
        self.window.destroy()
        showP = Check_Profit_Loss_GUI.show()
        showP.add_background()
        showP.add_table()
    def add_customer(self):
        self.window.destroy()
        home = Add_Customer.data()
        home.add_background()
        home.add_frame()
    def customer_record(self):
        self.window.destroy()
        showP = Customer_Records.show()
        showP.add_background()
        showP.add_table()
Exemple #30
0
class ViewBookWindow:
    def __init__(self):
        self.win = tk.Tk()
        self.canvas = Canvas(self.win, width=800, height=450, bg='white')
        self.canvas.pack(expand=YES, fill=BOTH)

        # show window in center of the screen
        width = self.win.winfo_screenwidth()
        height = self.win.winfo_screenheight()
        x = int(width / 2 - 800 / 2)
        y = int(height / 2 - 450 / 2)
        str1 = "800x450+" + str(x) + "+" + str(y)
        self.win.geometry(str1)

        # disable resize window
        self.win.resizable(False, False)

        # changing title of the window
        self.win.title("| VIEWING BOOK DETAILS | LIBRARY MANAGEMENT SYSTEM |")

    def add_frame(self):
        self.frame = Frame(self.win, height=450, width=800)
        self.frame.place(x=0, y=0)

        # x, y = 0, 0

        self.label = Label(self.frame, text="VIEW BOOK DETAILS", fg='black')
        self.label.config(font=("Poppins", 20, 'underline bold'))
        self.label.place(x=265, y=30)

        # use tree view to show details from the table
        self.tr = Treeview(self.frame,
                           columns=('A', 'B', 'C', 'D', 'E'),
                           selectmode="extended")

        # heading key + text
        self.tr.heading('#0', text='BOOK_ID')
        self.tr.column('#0', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#1', text='BOOK_TITLE')
        self.tr.column('#1', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#2', text='AUTHOR NAME')
        self.tr.column('#2', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#3', text='PUBLISHED_YEAR')
        self.tr.column('#3', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#4', text='PRICE')
        self.tr.column('#4', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#5', text='BOOK_CATEGORY')
        self.tr.column('#5', minwidth=0, width=115, stretch=NO)

        self.list = [
            'None', 'First Sem', 'Second Sem', 'Third Sem', 'Fourth Sem',
            'Fifth Sem', 'Sixth Sem', 'Seventh Sem', 'Eighth Sem',
            'Management', 'Technology', 'News paper', 'Magazines'
        ]
        self.filter = tk.StringVar(self.frame)
        self.drop = tk.OptionMenu(self.frame, self.filter, *self.list)
        self.drop.config(width=24)
        self.filter.set(self.list[0])
        self.drop.place(x=440, y=94)
        # self.filter = Entry(self.frame, font="Arial 12")
        # self.filter.place(x=440, y=94)
        search_text = self.filter.get()
        self.btn = Button(self.frame,
                          text='SEARCH',
                          width=9,
                          bg='white',
                          fg='black',
                          font=("Poppins", 11, "bold"),
                          command=self.sea)
        self.btn.place(x=630, y=90)
        j = 0

        for i in Database.database.ViewBooks():
            self.tr.insert('',
                           index=j,
                           text=i[0],
                           values=(i[1], i[2], i[3], i[4], i[5]))
            j += 1
        self.tr.place(x=100, y=140)

    def sea(self):
        nk = (self.filter.get(), )
        self.tr = Treeview(self.frame,
                           columns=('A', 'B', 'C', 'D', 'E'),
                           selectmode="extended")
        print(nk)

        # heading key + text
        self.tr.heading('#0', text='BOOK_ID')
        self.tr.column('#0', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#1', text='BOOK_TITLE')
        self.tr.column('#1', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#2', text='AUTHOR NAME')
        self.tr.column('#2', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#3', text='PUBLISHED_YEAR')
        self.tr.column('#3', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#4', text='PRICE')
        self.tr.column('#4', minwidth=0, width=100, stretch=NO)
        self.tr.heading('#5', text='BOOK_CATEGORY')
        self.tr.column('#5', minwidth=0, width=115, stretch=NO)

        j = 0
        if nk[0] == "":
            for i in Database.database.ViewBooks():
                self.tr.insert('',
                               index=j,
                               text=i[0],
                               values=(i[1], i[2], i[3], i[4], i[5]))
                j += 1
        else:
            for i in Database.database.filter(nk):
                self.tr.insert('',
                               index=j,
                               text=i[0],
                               values=(i[1], i[2], i[3], i[4], i[5]))
                j += 1

        self.tr.place(x=100, y=140)
        self.win.mainloop()