Problem in combo box in tkinter.ttk

Hello
i am new in python programming and i had some trouble with using combo box in tkinter

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


UserData = []

# Screen Customize
Screen = Tk()
Screen.title("Review")
Screen.geometry("%dx%d+%d+%d" % (800, 400 ,200, 200))
Screen.resizable(False, False)
Screen.iconbitmap("icon/icon.ico")

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

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

# Function
def Clean(value):
    for item in value:
        item.set("")


def Register(user):
    if int(user["age"]) > 18:
        messagebox.showinfo("Done!", "Done!")
        UserData.append(user)
        print(UserData)
        return True
    else:
        messagebox.showerror("Error", "+18")


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

    if not Name.isalpha():
        messagebox.showwarning("Warning!", "please enter only letters in name and family name box")
        return False

    if not Family.isalpha():
        messagebox.showwarning("Warning!", "please enter only letters in name and family name box")
        return False

    if NameBox.get() == "" or FamilyBox.get() == "" or AgeBox.get() == "":
        messagebox.showwarning("Warning!", "please enter all of your information")
        return

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

    if result:
        list = [name, family, age]
        InsertData(list)
        Clean(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 SearchClicked():
    query = SearchBox.get()
    result = Search(query)

    Clear()
    Load(result)



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


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

    result = messagebox.askquestion("Are You Sure?", "Are You Sure You Want To Delete This?")
    if result == "yes":
        Delete()


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

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


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



def ShowSearchClicked():
    SearchFrame.place(x=300, y=0)


def HideSearchClicked():
    SearchFrame.place_forget()


def ComboBox():
    counter = []
    for item in range(80):
        counter.append(item)
    return counter
# PhotoImage
SearchBg = PhotoImage(file="img/435.png")
HideSearchPhoto = PhotoImage(file="img/Hide.png")
ShowSearchPhoto = PhotoImage(file="img/Show.png")


# Frame
SearchFrame = Frame(Screen, width=300, height=200, bg="gray")
SearchFrame.place(x=250, y=0)
SearchFrame.place_forget()

# Label
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)
Label(SearchFrame, text="#", image=SearchBg).place(x=0, y=0)

# TextBox
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=60, y=6)
# Button
RegisterButton = Button(Screen, text="Register", bg="lime", font="normal 10 bold",command=RegisterClicked)
RegisterButton.place(x=0, y=160)

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

DeleteButton = Button(Screen, font="normal 12 bold", image=Cross, command=DeleteClicked)
DeleteButton.place(x=0, y=300)

Edit = Button(Screen, text="Edit", bg="gray", font="normal 12 bold", command=Edit)
Edit.place(x=0, y=250)

ShowSearch = Button(Screen, text="ShowSearch", bg="white", font="normal 10 bold", command=ShowSearchClicked, image=ShowSearchPhoto)
ShowSearch.place(x=0, y=200)

HideSearch = Button(SearchFrame, text="#", image=HideSearchPhoto, bg="gray", command=HideSearchClicked)
HideSearch.place(x=235, y=0)
# 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
AgeComboBox = ttk.Combobox(Screen, state="readonly", textvariable=age).place(x=70, y=110)
ValuesCombo = ComboBox()
AgeComboBox["value"] = ValuesCombo
AgeComboBox.current(20)
Screen.mainloop()

this is the all of my code

this is the error that i get every time i really appreciate it if you can help me

You have:

AgeComboBox = ttk.Combobox(Screen, state="readonly", textvariable=age).place(x=70, y=110)

This creates a combobox and then calls its place method, but that method returns None.

Instead, do this:

AgeComboBox = ttk.Combobox(Screen, state="readonly", textvariable=age)
AgeComboBox.place(x=70, y=110)

Thanks it now works :slight_smile: