Help with tkiter listbox

Hello
i was completeing myprogram and i saw an problem with it

from tkinter import *
from tkinter import ttk
from tkinter import messagebox

UserData = []

# Screen Customize
Screen = Tk()
Screen.title("panel")
Screen.iconbitmap("icon/icon.ico")
Screen.geometry("%dx%d+%d+%d" % (700, 450, 200, 200))
Screen.resizable(False, False)


# String Variable
name = StringVar()
family = StringVar()
age = StringVar()

# IntVar
CountryMode = IntVar()
WorldMode = IntVar()
PlanetMode = IntVar()
Sex = IntVar()
# Function
def ClearBox(value):
    for item in value:
        item.set("")


def Register(user):
    if int(user["age"]) > 18:
        messagebox.showinfo("Done!", "Done!")
        UserData.append(user)
        return True
    else:
        messagebox.showwarning("Warning!", "You should be 18+")
        return False


def RegisterButtonClicked():
    Name = name.get()
    Family = family.get()
    Age = age.get()

    if NameBox.get() == "" or FamilyBox.get() == "" or AgeBox.get() == "":
        messagebox.showerror("Error", "please Enter all of your information")
        return

    if not Age.isdigit():
        messagebox.showwarning("Warning!", "please enter only number for your age")
        return False

    if not Name.isalpha():
        messagebox.showwarning("Warning!", "please enter only words for your name and family name")
        return False

    if not Family.isalpha():
        messagebox.showwarning("Warning!", "please enter only words for your name and family name")
        return False

    us = {"name": Name, "family": Family, "age": Age}
    result = Register(us)

    print(CountryMode.get())
    if result:
        list = [name, family, age]
        InsertData(list)
        ClearBox(list)
        NameBox.focus_set()


def InsertData(value):
    tbl.insert('', "end", values=[value[0].get(), value[1].get(), value[2].get()])


def Select(e):
    Selection_row = tbl.selection()
    if Selection_row != ():
        name.set(tbl.item(Selection_row)["values"][0])
        family.set(tbl.item(Selection_row)["values"][1])
        age.set(tbl.item(Selection_row)["values"][2])


def Search(value):
    SecondList = []
    for item in UserData:
        if item["name"] == value or item["family"] == value or item["age"] == value:
            SecondList.append(item)
    return SecondList


def SearchButtonClicked():
    query = SearchBox.get()
    result = Search(query)

    Clean()
    Load(result)


def Clean():
    for item in tbl.get_children():
        sel = (str(item),)
        tbl.delete(sel)


def Load(value):
    for item in value:
        tbl.insert('', "end", values=[item["name"], item["family"], item["age"]])


def DeleteClicked():
    Selection_row = tbl.selection()
    if Selection_row == ():
        messagebox.showwarning("Warning!", "please chose a user to delete!!!")
        return False

    if Selection_row:
        result = messagebox.askquestion("Are You Sure?", "Do You Wish To Delete This?")

        if result == "yes":
            Delete()


def Delete():
    Selection_row = tbl.selection()
    if Selection_row != ():
        SelectItem = tbl.item(Selection_row)["values"]
        Dictionary = {"name": SelectItem[0], "family": SelectItem[1], "age": str(SelectItem[2])}
        tbl.delete(Selection_row)
        UserData.remove(Dictionary)


def EditClicked():
    Selection_row = tbl.selection()
    SelectItem = tbl.item(Selection_row)["values"]
    Dictionary = {"name": SelectItem[0], "family": SelectItem[1], "age": str(SelectItem[2])}
    UserIndex = UserData.index(Dictionary)
    UserData[UserIndex] = {"name": name.get(), "family": family.get(), "age": age.get()}

    if Selection_row != ():
        tbl.item(Selection_row, values=[name.get(), family.get(), age.get()])


def ShowSearchClicked():
    SearchFrame.place(x=110, y=250)


def HideButtonClicked():
    SearchFrame.place_forget()


def GetValue():
    Counter = []
    for item in range(20, 80):
        Counter.append(item)
    return Counter


def Write():
    try:
        value=listbox.get(listbox.curselection())
        print(value)

    except:
            print("Kizuna AI")
def kk(e):
    print(listbox)
# Frames
SearchFrame = Frame(Screen, background="red",width=300, height=150)
SearchFrame.place(x=110, y=225)
SearchFrame.place_forget()

# PhotoImage
SearchPhoto = PhotoImage(file="img/Galaxy.png")
ClosePhoto = PhotoImage(file="img/Cross.png")

# Label
BackgroundLabel = Label(SearchFrame, text="#", image=SearchPhoto).place(x=0, y=0)
Label(Screen, text="Name:", font="normal 20 bold").place(x=0, y=0)
Label(Screen, text="FamilyName:", font="normal 20 bold").place(x=0, y=50)
Label(Screen, text="Age:", font="normal 20 bold").place(x=0, y=100)
# Entry
NameBox = Entry(Screen)
NameBox.configure(width=20, textvariable=name)
NameBox.place(x=90, y=10)

FamilyBox = Entry(Screen)
FamilyBox.configure(width=20, textvariable=family)
FamilyBox.place(x=180, y=60)

AgeBox = Entry(Screen)
AgeBox.configure(width=20, textvariable=age)
AgeBox.place(x=70, y=110)

SearchBox = Entry(SearchFrame)
SearchBox.configure(width=20)
SearchBox.place(x=0, y=4)

# Button
RegisterButton = Button(Screen, text="Register", bg="lime", font="normal 15 bold", command=RegisterButtonClicked)
RegisterButton.place(x=0, y=170)

SearchButton = Button(SearchFrame, text="Search", bg="aqua", font="normal 10 bold", command=SearchButtonClicked)
SearchButton.place(x=130, y=0)

DeleteButton = Button(Screen, text="Delete", bg="Purple", font="normal 10 bold", command=DeleteClicked)
DeleteButton.place(x=120, y=220)

EditButton = Button(Screen, text="Edit", bg="#c900db", font="normal 10 bold", command=EditClicked)
EditButton.place(x=0, y=230)

ShowSearchBtn = Button(Screen, text="ShowSearch", font="normal 10 bold", bg="lime", command=ShowSearchClicked)
ShowSearchBtn.place(x=0, y=260)

HideSearchButton = Button(SearchFrame, text="HideSearch", bg="red", font="normal 10 bold", command=HideButtonClicked, image=ClosePhoto)
HideSearchButton.place(x=0, y=22)
# Tables
tbl = ttk.Treeview(Screen, columns="c1, c2, c3", show="headings")
tbl.bind("<Button-1>", Select)
tbl.column("# 1", width=50)
tbl.heading("# 1", text="Name")

tbl.column("# 2", width=90)
tbl.heading("# 2", text="FamilyName")

tbl.column("# 3", width=50)
tbl.heading("# 3", text="Age")

# Tabel
tbl = ttk.Treeview(Screen, columns="c1, c2, c3", show="headings")
tbl.bind("<Button-1>", Select)
tbl.column("# 1", width=50)
tbl.heading("# 1", text="Name")

tbl.column("# 2", width=90)
tbl.heading("# 2", text="FamilyName")

tbl.column("# 3", width=50)
tbl.heading("# 3", text="Age")

tbl.pack(side=RIGHT, fill=BOTH)

# ComboBox
AgeCombo = ttk.Combobox(Screen, state="readonly",  textvariable=age)
ValuesCombo = GetValue()
AgeCombo["value"] = ValuesCombo
AgeCombo.place(x=70, y=110)

# CheckBox
ButtonCheck1 = Checkbutton(Screen, text="Country", variable=CountryMode)
ButtonCheck1.place(x=200, y=200)

ButtonCheck2 = Checkbutton(Screen, text="World", variable=WorldMode)
ButtonCheck2.place(x=200, y=250)

ButtonCheck3 = Checkbutton(Screen, text="Planet", variable=PlanetMode)
ButtonCheck3.place(x=200, y=300)

# RadioBox
SexMale = Radiobutton(Screen, variable=Sex, value=1, text="Male").place(x=100, y=170)
SexFemale = Radiobutton(Screen, variable=Sex, value=2, text="Female").place(x=150, y=170)

# Menu
menu = Menu(Screen)
UserMenu = Menu(menu, tearoff=0)
UserMenu.add_command(label="Save", command=Write)
UserMenu.add_command(label="Save As", command=Write)

menu.add_cascade(label="File", menu=UserMenu)
Screen.config(menu=menu)

# list box
listbox = Listbox(Screen)
listbox.bind("<Button-1>", kk)
listbox.insert(1, "majid")
listbox.insert(2, "Ahmad")
listbox.insert(3, "Ali")
listbox.insert(4, "reza")
listbox.place(x=100, y=250)





Screen.mainloop()


this is all of my code as you may understand while running it this returns !listbox while i click on one of those names in my list box

listbox = Listbox(Screen)
listbox.bind("<Button-1>", kk)
listbox.insert(1, "majid")
listbox.insert(2, "Ahmad")
listbox.insert(3, "Ali")
listbox.insert(4, "reza")
listbox.place(x=100, y=250)

and

def kk(e):
    print(listbox)

are probably the only lines that you need check or change
okay any way i would be happy if you help me

You’re telling it to print out the value of listbox when you click on the listbox.

listbox refers to a listbox, and tkinter names its widgets so that you can tell them apart.

.!listbox is the name of the listbox.

If you had more listboxes, tkinter would name them .!listbox2, .!listbox3, etc.

If you want to know which item in a listbox has been selected, use its .curselection() method.

Note, however, that .curselection() will return the selected indexes from before the button press, so you really need to bind the handler kk to <ButtonRelease-1> rather than <Button-1>.

On another point, I find the variables naming confusing. The standard is to use “snake_case”, i.e. lowercase with underscores, for variables and functions and “PascalCase” for classes.

You have, for example, name as the name for a tkinter variable and Name as the name for its value; I think it would be clearer to call them, say, “name_var” and “name” respectively.

thanks for your help