Exemple #1
0
def view_command():
    list.delete(0, END)
    """
    We want to insert each of the tuple of the list as a new row in the ListBox
    So for that we iterate through the list.
    END ensures that every new row is inserted at the end of the existing rows
    in the ListBox.
    """
    for row in bookstore_backend.view():
        # print(row)
        # print(type(row))
        list.insert(END, row)
Exemple #2
0
def add_command():
    bookstore_backend.insert(title_text.get(), author_text.get(), year_text.get(), isbn_text.get())
    list1.delete(0, len(bookstore_backend.view()))
    list1.insert(-1, (title_text.get(), author_text.get(), year_text.get(), isbn_text.get()))
Exemple #3
0
def search_command():
    list1.delete(0, len(bookstore_backend.view()))
    count = 0
    for row in bookstore_backend.search(title_text.get(), author_text.get(), year_text.get(), isbn_text.get()):
        list1.insert(count, row)
        count += 1
Exemple #4
0
def view_command():
    list1.delete(0, len(bookstore_backend.view()))
    count = 0
    for row in bookstore_backend.view():
        list1.insert(count, row)
        count += 1
Exemple #5
0
    text="Add Entry",
    command=lambda: bb.add_entry(entry1_value.get(), entry2_value.get(),
                                 entry3_value.get(), entry4_value.get()))
button4 = Button(
    window,
    text="Update Selected",
    command=lambda: bb.update_selected(entry1_value.get(), entry2_value.get(),
                                       entry3_value.get(), entry4_value.get()))
button5 = Button(
    window,
    text="Delete Selected",
    command=lambda: bb.delete_selected(listbox, listbox.curselection()))
button6 = Button(window, text="Close", command=window.destroy)
button1.grid(row=2, column=3)
button2.grid(row=3, column=3)
button3.grid(row=4, column=3)
button4.grid(row=5, column=3)
button5.grid(row=6, column=3)
button6.grid(row=7, column=3)

listbox = Listbox(window, height=6, width=35)
listbox.grid(row=2, column=0, columnspan=2, rowspan=6)

scrollbar = Scrollbar(window, command=listbox.yview)
scrollbar.grid(row=4, column=2, rowspan=3)

bb.insert("hp", "jkr", 1998, 1281938)
print(bb.view())

window.mainloop()
def view_command():
    list1.delete(0, END)
    for row in bookstore_backend.view():
        list1.insert(END, row)