Help me fix this code:
import PySimpleGUI as sg
from pokemon_sql import *
import sqlitedb as db


from pokemon_gui_entry import show_pokemon_form
from pokemon_class import PokemonType



# VARIABLES/LISTS (I think)-------------------------------------------------

sg.theme("HotDogStand")
FORM_FONT = "Calibri 16"
LABEL_SIZE = (10, 1)
BUTTON_SIZE = (7, 1)
BUTTON_PAD = ((10, 0), (20, 0))
BG = "Black"



db.db_file = pokemon_database  # IN BOOK IT SAYS db.db_file = mission_database BUT CHANGE IT TO db.db_file = pokemon_database
pokemon_list = []
pokemon_data = []
data_index = -1



# WINDOW/LAYOUT-------------------------------------------------



form = [
    [
        sg.Text("Name", size=LABEL_SIZE, background_color=BG,),
        sg.Text("", key="name", background_color=BG,),
    ],
    [
        sg.Text("Nickname", size=LABEL_SIZE, background_color=BG,),
        sg.Text("", key="nick", background_color=BG,),
    ],
    [
        sg.Text("Height", size=LABEL_SIZE, background_color=BG,),
        sg.Text("", key="height", background_color=BG,),
        sg.Text("ft", key="name", background_color=BG,),
    ],
    [
        sg.Text("Weight", size=LABEL_SIZE, background_color=BG,),
        sg.Text("", key="weight", background_color=BG,),
        sg.Text("lbs", key="name", background_color=BG,),
    ],
    [
        sg.Text("Description", size=LABEL_SIZE, background_color=BG,),
        sg.Text("", key="desc", background_color=BG,),
    ],
    [
        sg.Text("Type", size=LABEL_SIZE, background_color=BG),
        sg.Text("", key="type1", font=("Calibri", 16, "bold"), background_color=BG, text_color="white", border_width=2.5, pad=((4, 0),(4, 4))),
        sg.Text("", key="type2", font=("Calibri", 16, "bold"), background_color=BG, text_color="white", border_width=2.5, pad=((0, 0),(4, 4))),
    ],
]



layout = [
    [
        sg.Listbox(
            [],
            key="list",
            size=(20, 10),
            default_values=None,
            select_mode=None,
            enable_events=True,
            font=FORM_FONT,
        ),
        sg.Column(
            form,
            size=(400, 275),
            vertical_alignment="top",
            element_justification="left",
            background_color=BG,
        ),
    ],
    [
        sg.OK("OK", key="ok", pad=BUTTON_PAD, size=BUTTON_SIZE),
        sg.Button("Add", key="add", pad=BUTTON_PAD, size=BUTTON_SIZE),
        sg.Button("Edit", key="edit", pad=BUTTON_PAD, size=BUTTON_SIZE),
        sg.Button("Delete", key="delete", pad=BUTTON_PAD, size=BUTTON_SIZE),
    ],

]



# FUNCTIONS---------------------------------------------------------------------

def remove_string(string):
    string.replace("'", "")
    return string





def pokemon_data_to_list():
    global pokemon_list, data_index
    pokemon_list = db.query_table("SELECT pokemon_name FROM pokemon")
    values = []
    for pokemon in pokemon_list:
        values.append(pokemon[0])
    if len(values) > 0 and data_index == -1:
        data_index = 0
    window["list"].update(values=values, set_to_index=data_index)





def pokemon_data_to_form(name):  # Get values for the selected pokemon
    global pokemon_data
    if data_index > -1:
        if name == None:
            name = pokemon_list[data_index][0]
        sql_query = (
            """
                    SELECT * FROM pokemon
                    INNER JOIN pokemon_stats ON pokemon.pokemon_stats_id = pokemon_stats.pokemon_stats_id
                    WHERE pokemon_name =
                    """
            + '"'
            + name
            + '";'
        )
        pokemon_data = db.query_table(sql_query)
        print(name,sql_query,pokemon_data)

        window["name"].update(value=pokemon_data[0][1])
        window["nick"].update(value=pokemon_data[0][4])
        window["weight"].update(value=pokemon_data[0][5])
        window["height"].update(value=pokemon_data[0][6])
        window["desc"].update(value=pokemon_data[0][7])
        window["type1"].update(
            value=pokemon_data[0][8],
            background_color=PokemonType[remove_string(pokemon_data[0][8])].value,
        )
        window["type2"].update(
            value=pokemon_data[0][9],
            background_color=PokemonType[remove_string(pokemon_data[0][9])].value,
        )

        #window['desc'].update()





def pokemon_type_name_to_id(s):
    sql_query = (
        """
                SELECT * FROM pokemon
                WHERE pokemon_name =
                """
        + '"'
        + s
        + '";'
    )  # IN BOOKLET IT SAYS pokemon_name = IN THE LINE ABOVE IT NEEDS TO BE pokemon_type_name =

    d = db.query_table(sql_query)
    #print("pokemon_id_from_name = ", d)
    return d[0][0]





# MISC STUFF-------------------------------------------------------------------



window = sg.Window(
    "POKEMON List", layout, finalize=True, font=FORM_FONT, margins=(10, 20)
)



pokemon_data_to_list()
pokemon_data_to_form(None)



print(pokemon_data[0])

# MAIN LOOP--------------------------------------------------------------------



while True:
    event, values = window.read(timeout=10)
    if not event == "__TIMEOUT__":
        print(event, "|", values)
    if event in ["Exit", sg.WIN_CLOSED, "ok"]:
        break



    elif event == "list":
        pokemon_data_to_form(values["list"][0])



    elif event in ["add", "edit"]:
        if event == "edit" and data_index > -1:
            data = {}
            data["pokemon_name"] = pokemon_data[0][1]
            data["nick"] = pokemon_data[0][4]
            data["pokemon_weight"] = pokemon_data[0][5]
            data["pokemon_height"] = pokemon_data[0][6]
            data["desc"] = pokemon_data[0][7]
            data["pokemon_type1"] = pokemon_data[0][8]
            data["pokemon_type2"] = pokemon_data[0][9]
        else:
            data = None
            pokemon_data = None
        data = show_pokemon_form(data)



        if data != None:
            pokemon = []
            pokemon_stats = []
            pokemon_stats.append(data["pokemon_name"])
            pokemon_stats.append(data["nick"])
            pokemon_stats.append(data["pokemon_weight"])
            pokemon_stats.append(data["pokemon_height"])
            pokemon_stats.append(data["desc"])
            pokemon_stats.append(data["pokemon_type1"])
            pokemon_stats.append(data["pokemon_type2"])





            if pokemon_data == None:  # add to the list
                sql = """
                        INSERT INTO pokemon(pokemon_name)
                        VALUES(?);
                        """
                id = db.insert_record(sql, pokemon)
                sql = """
                        UPDATE pokemon
                        SET pokemon_stats_id = pokemon_id
                        WHERE pokemon_name = ?
                        """
                id = db.update_record(sql, pokemon)
                sql = """
                        INSERT INTO pokemon_stats(pokemon_stats_nick, pokemon_stats_weight, pokemon_stats_height, pokemon_type_desc, pokemon_stats_type_one,
                            pokemon_stats_type_two)
                        VALUES(?,?,?,?,?,?);
                        """
                id = db.insert_record(sql, pokemon_stats)
                print("Added pokemon stats record", id)

            else:  # edit the list
                pokemon.append(pokemon_data[0][0])
                id = db.update_record(sql_update_pokemon, pokemon)
                print("Updated pokemon record", id)
                pokemon_stats.append(pokemon_data[0][0])
                id = db.update_record(sql_update_pokemon_stats, pokemon_stats)
                print("Updated pokemon record", id)

            pokemon_data_to_list()
            pokemon_data_to_form(data["pokemon_name"])



    elif event == "delete":
        if pokemon_data != None:
            data = [pokemon_data[0][0]]
            sql = """
                DELETE FROM pokemon
                WHERE pokemon_id = ?
                """
            ok = db.update_record(sql, data)
            print("Pokemon Deleted")
            sql = """
                DELETE FROM pokemon_stats
                WHERE pokemon_stats_id = ?
                """
            ok = db.update_record(sql, data)
            if ok:
                print("Record deleted")



            pokemon_data_to_list()
            pokemon_data_to_form(None)



window.close()


Error:

BULBASAUR 
                    SELECT * FROM pokemon
                    INNER JOIN pokemon_stats ON pokemon.pokemon_stats_id = pokemon_stats.pokemon_stats_id
                    WHERE pokemon_name =
                    "BULBASAUR"; [(1, 'BULBASAUR', 1, 1, 'ROSER', 6.9, 0.7, 'Funny Pokemon', 'GRASS', 'POISON')]
(1, 'BULBASAUR', 1, 1, 'ROSER', 6.9, 0.7, 'Funny Pokemon', 'GRASS', 'POISON')
edit | {'list': ['BULBASAUR']}
ok | {'pokemon_name': 'BULBASAU', 'nick': 'ROSER', 'pokemon_height': '0.7', 'pokemon_weight': '6.9', 'desc': 'Funny Pokemon', 'pokemon_type1': 'GRASS', 'pokemon_type2': 'POISON'}
Incorrect number of bindings supplied. The current statement uses 2, and there are 1 supplied.
Updated pokemon record False
Incorrect number of bindings supplied. The current statement uses 7, and there are 8 supplied.
Updated pokemon record False
BULBASAU 
                    SELECT * FROM pokemon
                    INNER JOIN pokemon_stats ON pokemon.pokemon_stats_id = pokemon_stats.pokemon_stats_id
                    WHERE pokemon_name =
                    "BULBASAU"; []
Traceback (most recent call last):
  File "/Users/kory/mu_code/pokemon_gui.py", line 272, in <module>
    pokemon_data_to_form(data["pokemon_name"])
  File "/Users/kory/mu_code/pokemon_gui.py", line 137, in pokemon_data_to_form
    window["name"].update(value=pokemon_data[0][1])
IndexError: list index out of range

--------------------
This happens when I try use my edit function and change the name.