Python Forum
printing selected item with Sqlite data
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
printing selected item with Sqlite data
#6
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

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)
Reply


Messages In This Thread
RE: printing selected item with Sqlite data - by whacky7 - Jan-19-2020, 12:09 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  need help with data analysing with python and sqlite Hardcool 2 1,084 Jan-30-2024, 06:49 AM
Last Post: Athi
  Remove an item from a list contained in another item in python CompleteNewb 19 8,981 Nov-11-2021, 06:43 AM
Last Post: Gribouillis
  Extracting and printing data ajitnayak1987 0 1,847 Jul-28-2021, 09:30 AM
Last Post: ajitnayak1987
  Error while transferring data from sqlite to elasticsearch - please help! ps96068 1 3,765 Jun-12-2021, 09:24 AM
Last Post: ibreeden
  Importing data from a text file into an SQLite database with Python macieju1974 7 6,339 Jun-29-2020, 08:51 PM
Last Post: buran
  Printing data scratchmyhead 4 3,658 Nov-08-2019, 11:25 PM
Last Post: jefsummers
  How can I only receive data from selected serial numbers MasterCATZ 7 4,769 Apr-20-2019, 08:35 AM
Last Post: MasterCATZ
  Need help with SQLite data input donmerch 4 6,695 Feb-06-2018, 10:09 AM
Last Post: donmerch

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020