Here is my code about adding a book information: ( i make a normal display about book information and some "adding" and "delete" button )
import tkinter
from tkinter import *
from tkinter import END
bt = Tk()
bt.geometry("500x400")
global book_name
global author_name
global type_book
global quantity
global price
global ls1
book_name = StringVar()
author_name = StringVar()
type_book = StringVar()
quantity = StringVar()
price = StringVar()
def record():
book_name_verify = book_name
author_name_verify = author_name
type_book_verify = type_book
quantity_verify = quantity
price_verify = price
ls1.insert(END,book_name_verify,
author_name_verify,
type_book_verify,
quantity_verify,
price_verify)
name = Label(bt, text = "Book's name")
name.grid(row = 0, column = 0)
author = Label(bt, text = "Author")
author.grid(row = 1, column = 0)
btype = Label(bt, text = "Book's type")
btype.grid(row = 0, column = 2)
quantity = Label(bt, text = "Quantity")
quantity.grid(row = 1, column = 2)
price = Label(bt, text = "price")
price.grid(row = 2, column = 0)
e1 = Entry(bt, textvariable = book_name)
e1.grid(row = 0, column = 1)
e2 = Entry(bt, textvariable = author_name)
e2.grid(row = 1, column = 1)
e3 = Entry(bt, textvariable = type_book)
e3.grid(row = 0, column = 3)
e4 = Entry(bt, textvariable = quantity)
e4.grid(row = 1, column = 3)
e5 = Entry(bt, textvariable = price)
e5.grid(row = 2, column = 1)
ls1 = Listbox(bt, height = 15,width = 60) #list box
ls1.grid(row = 3, column = 0, columnspan= 5)
#Button part
bn1 = Button(bt, text = "Add", width = 12,command=record)
bn1.grid(row = 5, column = 1)
bt.mainloop()
I have a problem that when i try to input the variables into my list box that: enter image description here
Hope you guys can help me to fix this problem
