Data Entry error
<p>l would like to create  a control system for administrator on Tkinter and  some functions (add, delete, update and load) are main part of control system  but when l run the code , these functions do not work and there is no error message. But ,l could not figure out where the problem is. My code is still not completed yet. Ä°f l solve it, then l will move to another step.</p>

<pre><code>import tkinter
from tkinter import *


userlist = [
  ['Meyers',  '12356'],
  ['Smith','abcde'],
  ['Jones','123abc34'],
  ['Barnhart','12//348'],
  ['Nelson','1234'],
  ["Prefect",'1345'],
  ["Zigler",'8910'],
  ['Smith','1298']]


def domain():

    def whichSelected () :
        print ("At %s of %d" % (select.curselection(), len(userlist)))
        return int(select.curselection()[0])

    def addEntry():
        userlist.append ([nameVar.get(), passwordVar.get()])
        setSelect()

    def updateEntry():
        userlist[whichSelected()] = [nameVar.get(), passwordVar.get()]
        setSelect()

    def deleteEntry():
        del userlist[whichSelected()]
        setSelect()

    def loadEntry():
        name, password = userlist[whichSelected()]
        nameVar.set(name)
        passwordVar.set(password)

    def makeWindow():
        win=Tk()
        global nameVar, passwordVar, select

        frame1 = Frame(win)
        frame1.pack()

        Label(frame1, text="Name").grid(row=0, column=0, sticky=W)
        nameVar = StringVar()
        name = Entry(frame1, textvariable=nameVar)
        name.grid(row=0, column=1, sticky=W)

        Label(frame1, text="Password").grid(row=1, column=0, sticky=W)
        passwordVar= StringVar()
        password= Entry(frame1, textvariable=passwordVar)
        password.grid(row=1, column=1, sticky=W)

        frame2 = Frame(win)       # Row of buttons
        frame2.pack()
        b1 = Button(frame2,text=" Add  ",command=addEntry)
        b2 = Button(frame2,text="Update",command=updateEntry)
        b3 = Button(frame2,text="Delete",command=deleteEntry)
        b4 = Button(frame2,text=" Load ",command=loadEntry)
        b1.pack(side=LEFT); b2.pack(side=LEFT)
        b3.pack(side=LEFT); b4.pack(side=LEFT)

        frame3 = Frame(win)       # select of names

        frame3.pack()
        scroll = Scrollbar(frame3, orient=VERTICAL)
        select = Listbox(frame3, yscrollcommand=scroll.set, height=6)
        scroll.config (command=select.yview)
        scroll.pack(side=RIGHT, fill=Y)
        select.pack(side=LEFT,  fill=BOTH, expand=1)
        return win

    def setSelect():
        userlist.sort()
        select.delete(0,END)
        for name in userlist:
            select.insert(END,name)

    win=makeWindow()
    setSelect()
    win.mainloop()




page1=Tk()
but1=Button(page1,text="Domain",command=domain).pack()
</code></pre>

<p>There's a lot going wrong for your code.</p>

<p>For instance, you don't need to import <code>tkinter</code> twice. Your casing of the variable names doesn't follow <a href="https://www.python.org/dev/peps/pep-0008/" rel="nofollow">PEP8</a>. You could benefit from an <a href="https://en.wikipedia.org/wiki/Object-oriented_programming" rel="nofollow">OOP</a> approach.</p>

<p>I would suggest finding a good <a href="https://en.wikipedia.org/wiki/Integrated_development_environment" rel="nofollow">IDE</a> to code in that can highlight your formatting and errors.</p>

<p>Take a look at the provided code:</p>

<pre><code>import tkinter as tk

user_list = [
  ['Meyers',  '12356'],
  ['Smith','abcde'],
  ['Jones','123abc34'],
  ['Barnhart','12//348'],
  ['Nelson','1234'],
  ["Prefect",'1345'],
  ["Zigler",'8910'],
  ['Smith','1298']]


class Domain(tk.Frame):

    def __init__(self, parent):
        tk.Frame.__init__(self, parent)
        self.parent = parent
        self.name_var = tk.StringVar()
        self.password_var = tk.StringVar()
        self.make_window()

    def which_selected(self):
        print("At %s of %d" % (self.select.curselection(), len(user_list)))
        return int(self.select.curselection()[0])

    def add_entry(self):
        user_list.append([self.name_var.get(), self.password_var.get()])
        self.set_select()

    def update_entry(self):
        user_list[self.which_selected()] = [
            self.name_var.get(), self.password_var.get()]
        self.set_select()

    def delete_entry(self):
        del user_list[self.which_selected()]
        self.set_select()

    def load_entry(self):
        name, password = user_list[self.which_selected()]
        self.name_var.set(name)
        self.password_var.set(password)

    def make_window(self):
        frame1 = tk.Frame(self.parent)
        frame1.pack()

        tk.Label(frame1, text="Name").grid(row=0, column=0, sticky=tk.W)

        name = tk.Entry(frame1, textvariable=self.name_var)
        name.grid(row=0, column=1, sticky=tk.W)

        tk.Label(frame1, text="Password").grid(row=1, column=0, sticky=tk.W)

        password = tk.Entry(frame1, textvariable=self.password_var)
        password.grid(row=1, column=1, sticky=tk.W)

        frame2 = tk.Frame(self.parent)  # Row of buttons
        frame2.pack()
        b1 = tk.Button(frame2, text=" Add  ", command=self.add_entry)
        b2 = tk.Button(frame2, text="Update", command=self.update_entry)
        b3 = tk.Button(frame2, text="Delete", command=self.delete_entry)
        b4 = tk.Button(frame2, text=" Load ", command=self.load_entry)
        b1.pack(side=tk.LEFT)
        b2.pack(side=tk.LEFT)
        b3.pack(side=tk.LEFT)
        b4.pack(side=tk.LEFT)

        frame3 = tk.Frame(self.parent)  # select of names

        frame3.pack()
        scroll = tk.Scrollbar(frame3, orient=tk.VERTICAL)
        self.select = tk.Listbox(frame3, yscrollcommand=scroll.set, height=6)
        scroll.config(command=self.select.yview)
        scroll.pack(side=tk.RIGHT, fill=tk.Y)
        self.select.pack(side=tk.LEFT,  fill=tk.BOTH, expand=1)

    def set_select(self):
        user_list.sort()
        self.select.delete(0, tk.END)
        for name in user_list:
            self.select.insert(tk.END, name)

if __name__ == '__main__':
    root = tk.Tk()
    Domain(root)
    root.mainloop()
</code></pre>

<p><em>Note:</em>
There's still errors here, but I don't exactly know what you're trying to do so I've just restructured it here so you can start on a better path.</p>

python tkinter