Jan-19-2020, 12:09 AM
here is what my line of code when I click the Edit button.
I know that I will need to insert the SQL data into the text box. For the time being I am even having trouble getting the window to display the labels and fields.. not sure what I am missing?
Error
python index-testing.py
['', '', [9001, u'SW02', u'Cisco 2950-48', u'CAT746574576', 10], 0, '']
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1550, in __call__
return self.func(*args)
File "index-testing.py", line 935, in funcEditInvent
EditInvent()
File "index-testing.py", line 948, in EditInvent
EditForm()
File "index-testing.py", line 951, in EditForm
TopEditForm = Frame(EditForm, width=600, height=100, bd=1, relief=SOLID)
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 2583, in __init__
Widget.__init__(self, master, 'frame', cnf, {}, extra)
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 2095, in __init__
BaseWidget._setup(self, master, cnf)
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 2073, in _setup
self.tk = master.tk
AttributeError: 'function' object has no attribute 'tk'
Code below
I know that I will need to insert the SQL data into the text box. For the time being I am even having trouble getting the window to display the labels and fields.. not sure what I am missing?
Error
python index-testing.py
['', '', [9001, u'SW02', u'Cisco 2950-48', u'CAT746574576', 10], 0, '']
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1550, in __call__
return self.func(*args)
File "index-testing.py", line 935, in funcEditInvent
EditInvent()
File "index-testing.py", line 948, in EditInvent
EditForm()
File "index-testing.py", line 951, in EditForm
TopEditForm = Frame(EditForm, width=600, height=100, bd=1, relief=SOLID)
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 2583, in __init__
Widget.__init__(self, master, 'frame', cnf, {}, extra)
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 2095, in __init__
BaseWidget._setup(self, master, cnf)
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 2073, in _setup
self.tk = master.tk
AttributeError: 'function' object has no attribute 'tk'
Code below
def funcEditInvent(): selected_item=tree1.selection() device=tree1.item(selected_item) device=list(device.values()) print (device) EditInvent() def EditInvent(): editform = Toplevel() editform.title("ACT/Edit Inventory") width = 600 height = 500 screen_width = Home.winfo_screenwidth() screen_height = Home.winfo_screenheight() x = (screen_width/2) - (width/2) y = (screen_height/2) - (height/2) editform.geometry("%dx%d+%d+%d" % (width, height, x, y)) editform.resizable(0, 0) EditForm() def EditForm(): TopEditForm = Frame(EditForm, width=600, height=100, bd=1, relief=SOLID) TopEditForm.pack(side=TOP, pady=20) lbledit_text = Label(EditForm, text="Add New Device", font=('monospace', 16), width=600) lbledit_text.pack(fill=X) MidEdit = Frame(EditForm, width=600) MidEdit.pack(side=TOP, pady=50) lbl_changename = Label(MidEdit, text="Device Name:", font=('monospace', 15), bd=10) lbl_changename.grid(row=0, sticky=W) lbl_changemodel = Label(MidEdit, text="Device Model:", font=('monospace', 15), bd=10) lbl_changemodel.grid(row=1, sticky=W) lbl_changeserial = Label(MidEdit, text="Device Serial", font=('monospace', 15), bd=10) lbl_changeserial.grid(row=2, sticky=W) lbl_changelocation = Label(MidEdit, text="Pallet Number:", font=('monospace', 15), bd=10) lbl_changelocation.grid(row=3, sticky=W) devicename_new = Entry(MidEdit, textvariable=device_name, font=('monospace', 15), width=15) devicename_new.grid(row=0, column=1) devicemodel_new = Entry(MidEdit, textvariable=device_model, font=('monospace', 15), width=15) devicemodel_new.grid(row=1, column=1) deviceserial_new = Entry(MidEdit, textvariable=device_serial, font=('monospace', 15), width=15) deviceserial_new.grid(row=2, column=1) devicelocation_new = Entry(MidEdit, textvariable=pallet_number, font=('monospace', 15), width=15) devicelocation_new.grid(row=3, column=1) btn_submitchanges = Button(MidEdit, text="Save Changes", font=('monospace', 16), width=10, bg="#009ACD") btn_submitchanges.grid(row=4, columnspan=2, pady=20)