How can I replace an Entry widget with a Checkbutton one?

I've built a Tkinter form for data entry in a MySQL db. The form is very primitive in that it contains only Entry widgets so far. Some of the fields only require Yes/No (1/0) input. I'd like to change these out with Checkbuttons. I'm including the code for the entire form, so if someone could just show me how to modify one of those Entry fields, I can take it from there.

The Entry field I'd like to change is commented in the code as:
"7th field ==>> NEED Checkbutton HERE"

Please NOTE: I'm new to Tkinter (and don't have much programming background either). I'm sure there are a number of ways to have built this form, but I did mine with some help from EE. Please be gentle. Thank you.
#!/usr/bin/python
from Tkinter import *
import MySQLdb
 
# item entry form --------entry_item.py
## Connect to DB ***************************************
conn = MySQLdb.connect(host='localhost' , user='root', db='mind0')
##Create a cursor
curs = conn.cursor() 
## *****************************************************
# Root level form
class MyApp:
  def __init__(self):
    window = Tk()
    window.title('ITEM Entry Form')   
    frame = Frame(window)
    frame.pack()
## BEGIN Fields ***********************************************    
    self.fields = {}
#-------------- 1st field  
    l = Label(frame, text="Item ID:")
    l.grid(row=0, column=0)    
    self.fields['itemID'] = Entry(frame)
    self.fields['itemID'].grid(row=0, column=1)    
#-------------- 2nd field    
    l = Label(frame, text="Item Type ID:")
    l.grid(row=2, column=0)   
    self.fields['fk_itemTypeID'] = Entry(frame)
    self.fields['fk_itemTypeID'].grid(row=2, column=1)
#-------------- 3rd field  
    l = Label(frame, text="Manufacturer:")
    l.grid(row=4, column=0)    
    self.fields['fk_mfactID'] = Entry(frame)
    self.fields['fk_mfactID'].grid(row=4, column=1)    
#-------------- 4th field    
    l = Label(frame, text="ModelNo:")
    l.grid(row=6, column=0)   
    self.fields['itemModelNo'] = Entry(frame)
    self.fields['itemModelNo'].grid(row=6, column=1)
 
#-------------- new field 
#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 
#-------------- 5th field  
    l = Label(frame, text="Description:")
    l.grid(row=8, column=0)   
    self.fields['description'] = Entry(frame)
    self.fields['description'].grid(row=8, column=1)
#-------------- 6th field 
    l = Label(frame, text="Last user assigned:")
    l.grid(row=10, column=0)   
    self.fields['fk_lastUserID'] = Entry(frame)
    self.fields['fk_lastUserID'].grid(row=10, column=1)
##########################################################
#-------------- 7th field ==>> NEED Checkbutton HERE #################
##########################################################
#checkbutton ready? YesNo   
    l = Label(frame, text="Ready to issue?:")
    l.grid(row=12, column=0)   
    self.fields['ready'] = Entry(frame)
    self.fields['ready'].grid(row=12, column=1)
###########################################
###########################################
#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&  
    l = Label(frame, text="PartNo:")
    l.grid(row=14, column=0)    
    self.fields['itemPartNo'] = Entry(frame)
    self.fields['itemPartNo'].grid(row=14, column=1)    
#-------------- 8th field    
    l = Label(frame, text="SerialNo:")
    l.grid(row=16, column=0)   
    self.fields['itemSerialNo'] = Entry(frame)
    self.fields['itemSerialNo'].grid(row=16, column=1)
#-------------- 9th field  
    l = Label(frame, text="Purchased PO No:")
    l.grid(row=18, column=0)    
    self.fields['fk_itemPONo'] = Entry(frame)
    self.fields['fk_itemPONo'].grid(row=18, column=1)    
#-------------- 10th field    
    l = Label(frame, text="Item Cost:")
    l.grid(row=20, column=0)   
    self.fields['itemCost'] = Entry(frame)
    self.fields['itemCost'].grid(row=20, column=1)
#-------------- 11th field  
    l = Label(frame, text="Warranty Expiration:")
    l.grid(row=22, column=0)    
    self.fields['itemWarrExp'] = Entry(frame)
    self.fields['itemWarrExp'].grid(row=22, column=1)    
#-------------- 12th field    
    l = Label(frame, text="User Assigned:")
    l.grid(row=24, column=0)   
    self.fields['fk_userID'] = Entry(frame)
    self.fields['fk_userID'].grid(row=24, column=1)
#-------------- 13th field  
    l = Label(frame, text="Loaned:")
    l.grid(row=26, column=0)    
    self.fields['loaned'] = Entry(frame)
    self.fields['loaned'].grid(row=26, column=1)    
#-------------- 14th field    
    l = Label(frame, text="Comment:")
    l.grid(row=28, column=0)   
    self.fields['comment'] = Entry(frame)
    self.fields['comment'].grid(row=28, column=1)
#-------------- 15th field    
    l = Label(frame, text="Alias:")
    l.grid(row=30, column=0)   
    self.fields['alias'] = Entry(frame)
    self.fields['alias'].grid(row=30, column=1)
#-------------- 16th field    
    l = Label(frame, text="Vendor Puchased From:")
    l.grid(row=32, column=0)   
    self.fields['fk_vendID'] = Entry(frame)
    self.fields['fk_vendID'].grid(row=32, column=1)
#-------------- 17th field    
    l = Label(frame, text="Item Location:")
    l.grid(row=34, column=0)   
    self.fields['fk_locID'] = Entry(frame)
    self.fields['fk_locID'].grid(row=34, column=1)
#-------------- 18th field    
    l = Label(frame, text="Issued to user(1, or 0):")
    l.grid(row=36, column=0)   
    self.fields['issued'] = Entry(frame)
    self.fields['issued'].grid(row=36, column=1)        
                
## END Fields ************************************************ 
 
## BEGIN Buttons ########      
    submitbtn = Button(frame, text="Insert", command=self.do_insert)
    submitbtn.grid(row=300, column=0)
#..........    
    clearbtn = Button(frame, text="Clear", command=self.do_clear)
    clearbtn.grid(row=300, column=1)
## END Buttons ##########   
    window.mainloop()
    
## Insert and Clear functions
  def do_clear(self):  
    self.fields['itemID'].delete(0,END)
    self.fields['fk_itemTypeID'].delete(0,END)
    self.fields['fk_mfactID'].delete(0,END)
    self.fields['itemModelNo'].delete(0,END)
    self.fields['description'].delete(0,END)
    self.fields['fk_lastUserID'].delete(0,END)
    self.fields['ready'].delete(0,END)
    self.fields['itemPartNo'].delete(0,END)
    self.fields['itemSerialNo'].delete(0,END)  
    self.fields['fk_itemPONo'].delete(0,END)
    self.fields['itemCost'].delete(0,END)
    self.fields['itemWarrExp'].delete(0,END)
    self.fields['fk_userID'].delete(0,END)
    self.fields['loaned'].delete(0,END)
    self.fields['comment'].delete(0,END)
    self.fields['alias'].delete(0,END)
    self.fields['fk_vendID'].delete(0,END)
    self.fields['fk_locID'].delete(0,END)
    self.fields['issued'].delete(0,END)
                    
  def do_insert(self):
  	global curs
	sql = "insert into item (itemID,fk_itemTypeID, fk_mfactID, itemModelNo, description, fk_lastUserID, ready, itemPartNo, itemSerialNo, fk_itemPONo, itemCost, itemWarrExp, fk_userID, loaned, comment, alias, fk_vendID, fk_locID, issued) values ('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s');"%( 
		self.fields['itemID'].get(),
		self.fields['fk_itemTypeID'].get(),
		self.fields['fk_mfactID'].get(),
		self.fields['itemModelNo'].get(),
		self.fields['description'].get(),
		self.fields['fk_lastUserID'].get(),
		self.fields['ready'].get(),		
		self.fields['itemPartNo'].get(),
		self.fields['itemSerialNo'].get(),
		self.fields['fk_itemPONo'].get(),
		self.fields['itemCost'].get(),
		self.fields['itemWarrExp'].get(),
		self.fields['fk_userID'].get(),
		self.fields['loaned'].get(),
		self.fields['comment'].get(),
		self.fields['alias'].get(),
		self.fields['fk_vendID'].get(),
		self.fields['fk_locID'].get(),
		self.fields['issued'].get())
	
	curs.execute(sql)
	conn.commit()
	print sql
                   
if __name__=="__main__":
    MyApp()

Open in new window

lessthan2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Roger BaklundCommented:
To setup the checkbox, you need a tkinter IntVar variable to store the value, for instance like this:

    var = IntVar()
    self.fields['ready'] = Checkbutton(frame,variable=var)
    self.fields['ready'].var = var
    self.fields['ready'].grid(row=12, column=1)

In the do_clear() method, you can not use delete(), but you can do this:

    self.fields['ready'].var.set(0)

And in the do_insert() method, you can get the value like this:

    self.fields['ready'].var.get(),            
0
lessthan2Author Commented:
cxr, I'm glad you responded. You've helped me in the past.
I made the changes you suggest. When I try to run the form, Python complains:
  File "./item-frm_.py", line 56
    var = IntVar()
    ^
SyntaxError: invalid syntax
*************
Was I supposed to stick that variable at the top, or unindent it?
Thanks.
#!/usr/bin/python
from Tkinter import *
import MySQLdb
 
# item entry form --------entry_item.py
## Connect to DB ***************************************
conn = MySQLdb.connect(host='localhost' , user='root', db='mind0')
##Create a cursor
curs = conn.cursor() 
## *****************************************************
# Root level form
class MyApp:
  def __init__(self):
    window = Tk()
    window.title('ITEM Entry Form')   
    frame = Frame(window)
    frame.pack()
## BEGIN Fields ***********************************************    
    self.fields = {}
#-------------- 1st field  
    l = Label(frame, text="Item ID:")
    l.grid(row=0, column=0)    
    self.fields['itemID'] = Entry(frame)
    self.fields['itemID'].grid(row=0, column=1)    
#-------------- 2nd field    
    l = Label(frame, text="Item Type ID:")
    l.grid(row=2, column=0)   
    self.fields['fk_itemTypeID'] = Entry(frame)
    self.fields['fk_itemTypeID'].grid(row=2, column=1)
#-------------- 3rd field  
    l = Label(frame, text="Manufacturer:")
    l.grid(row=4, column=0)    
    self.fields['fk_mfactID'] = Entry(frame)
    self.fields['fk_mfactID'].grid(row=4, column=1)    
#-------------- 4th field    
    l = Label(frame, text="ModelNo:")
    l.grid(row=6, column=0)   
    self.fields['itemModelNo'] = Entry(frame)
    self.fields['itemModelNo'].grid(row=6, column=1)
 
#-------------- new field 
#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 
#-------------- 5th field  
    l = Label(frame, text="Description:")
    l.grid(row=8, column=0)   
    self.fields['description'] = Entry(frame)
    self.fields['description'].grid(row=8, column=1)
#-------------- 6th field 
    l = Label(frame, text="Last user assigned:")
    l.grid(row=10, column=0)   
    self.fields['fk_lastUserID'] = Entry(frame)
    self.fields['fk_lastUserID'].grid(row=10, column=1)
#####################################################
#####################################################    
#-------------- 7th field (RadioButton)
#checkbutton ready? YesNo   
	var = IntVar()
	self.fields['ready'] = Checkbutton(frame,variable=var)
	self.fields['ready'].var = var
   	self.fields['ready'].grid(row=12, column=1)
#####################################################
#####################################################
#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&  
    l = Label(frame, text="PartNo:")
    l.grid(row=14, column=0)    
    self.fields['itemPartNo'] = Entry(frame)
    self.fields['itemPartNo'].grid(row=14, column=1)    
#-------------- 8th field    
    l = Label(frame, text="SerialNo:")
    l.grid(row=16, column=0)   
    self.fields['itemSerialNo'] = Entry(frame)
    self.fields['itemSerialNo'].grid(row=16, column=1)
#-------------- 9th field  
    l = Label(frame, text="Purchased PO No:")
    l.grid(row=18, column=0)    
    self.fields['fk_itemPONo'] = Entry(frame)
    self.fields['fk_itemPONo'].grid(row=18, column=1)    
#-------------- 10th field    
    l = Label(frame, text="Item Cost:")
    l.grid(row=20, column=0)   
    self.fields['itemCost'] = Entry(frame)
    self.fields['itemCost'].grid(row=20, column=1)
#-------------- 11th field  
    l = Label(frame, text="Warranty Expiration:")
    l.grid(row=22, column=0)    
    self.fields['itemWarrExp'] = Entry(frame)
    self.fields['itemWarrExp'].grid(row=22, column=1)    
#-------------- 12th field    
    l = Label(frame, text="User Assigned:")
    l.grid(row=24, column=0)   
    self.fields['fk_userID'] = Entry(frame)
    self.fields['fk_userID'].grid(row=24, column=1)
#-------------- 13th field  
    l = Label(frame, text="Loaned:")
    l.grid(row=26, column=0)    
    self.fields['loaned'] = Entry(frame)
    self.fields['loaned'].grid(row=26, column=1)    
#-------------- 14th field    
    l = Label(frame, text="Comment:")
    l.grid(row=28, column=0)   
    self.fields['comment'] = Entry(frame)
    self.fields['comment'].grid(row=28, column=1)
#-------------- 15th field    
    l = Label(frame, text="Alias:")
    l.grid(row=30, column=0)   
    self.fields['alias'] = Entry(frame)
    self.fields['alias'].grid(row=30, column=1)
#-------------- 16th field    
    l = Label(frame, text="Vendor Puchased From:")
    l.grid(row=32, column=0)   
    self.fields['fk_vendID'] = Entry(frame)
    self.fields['fk_vendID'].grid(row=32, column=1)
#-------------- 17th field    
    l = Label(frame, text="Item Location:")
    l.grid(row=34, column=0)   
    self.fields['fk_locID'] = Entry(frame)
    self.fields['fk_locID'].grid(row=34, column=1)
#-------------- 18th field    
    l = Label(frame, text="Issued to user(1, or 0):")
    l.grid(row=36, column=0)   
    self.fields['issued'] = Entry(frame)
    self.fields['issued'].grid(row=36, column=1)        
                
## END Fields ************************************************ 
 
## BEGIN Buttons ########      
    submitbtn = Button(frame, text="Insert", command=self.do_insert)
    submitbtn.grid(row=300, column=0)
#..........    
    clearbtn = Button(frame, text="Clear", command=self.do_clear)
    clearbtn.grid(row=300, column=1)
## END Buttons ##########   
    window.mainloop()
    
## Insert and Clear functions
  def do_clear(self):  
    self.fields['itemID'].delete(0,END)
    self.fields['fk_itemTypeID'].delete(0,END)
    self.fields['fk_mfactID'].delete(0,END)
    self.fields['itemModelNo'].delete(0,END)
    self.fields['description'].delete(0,END)
    self.fields['fk_lastUserID'].delete(0,END)
    self.fields['ready'].var.set(0)    ### ADDED
    self.fields['itemPartNo'].delete(0,END)
    self.fields['itemSerialNo'].delete(0,END)  
    self.fields['fk_itemPONo'].delete(0,END)
    self.fields['itemCost'].delete(0,END)
    self.fields['itemWarrExp'].delete(0,END)
    self.fields['fk_userID'].delete(0,END)
    self.fields['loaned'].delete(0,END)
    self.fields['comment'].delete(0,END)
    self.fields['alias'].delete(0,END)
    self.fields['fk_vendID'].delete(0,END)
    self.fields['fk_locID'].delete(0,END)
    self.fields['issued'].delete(0,END)
                    
  def do_insert(self):
  	global curs
	sql = "insert into item (itemID,fk_itemTypeID, fk_mfactID, itemModelNo, description, fk_lastUserID, ready, itemPartNo, itemSerialNo, fk_itemPONo, itemCost, itemWarrExp, fk_userID, loaned, comment, alias, fk_vendID, fk_locID, issued) values ('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s');"%( 
		self.fields['itemID'].get(),
		self.fields['fk_itemTypeID'].get(),
		self.fields['fk_mfactID'].get(),
		self.fields['itemModelNo'].get(),
		self.fields['description'].get(),
		self.fields['fk_lastUserID'].get(),		
		self.fields['ready'].var.get(),    ### ADDED
		self.fields['itemPartNo'].get(),
		self.fields['itemSerialNo'].get(),
		self.fields['fk_itemPONo'].get(),
		self.fields['itemCost'].get(),
		self.fields['itemWarrExp'].get(),
		self.fields['fk_userID'].get(),
		self.fields['loaned'].get(),
		self.fields['comment'].get(),
		self.fields['alias'].get(),
		self.fields['fk_vendID'].get(),
		self.fields['fk_locID'].get(),
		self.fields['issued'].get())
	
	curs.execute(sql)
	conn.commit()
	print sql
                   
if __name__=="__main__":
    MyApp()

Open in new window

0
Roger BaklundCommented:
You must un-indent it one level (4 spaces), it is supposed to be on the same level as the other fields.
0
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

lessthan2Author Commented:
Actually, it was indented the same as the rest of them. I don't know why the pasted in code rendered that way (maybe from too many commented lines...?).
I attached it as a TXT file this time.
#!/usr/bin/python
from Tkinter import *
import MySQLdb
 
# item entry form --------entry_item.py
## Connect to DB ***************************************
conn = MySQLdb.connect(host='localhost' , user='root', db='mind0')
##Create a cursor
curs = conn.cursor()
## *****************************************************
# Root level form
class MyApp:
  def __init__(self):
    window = Tk()
    window.title('ITEM Entry Form')   
    frame = Frame(window)
    frame.pack()
## BEGIN Fields ***********************************************    
    self.fields = {}
    
#-------------- 1st field  
    l = Label(frame, text="Item ID:")
    l.grid(row=0, column=0)    
    self.fields['itemID'] = Entry(frame)
    self.fields['itemID'].grid(row=0, column=1)    
#-------------- 2nd field    
    l = Label(frame, text="Item Type ID:")
    l.grid(row=2, column=0)   
    self.fields['fk_itemTypeID'] = Entry(frame)
    self.fields['fk_itemTypeID'].grid(row=2, column=1)
#-------------- 3rd field  
    l = Label(frame, text="Manufacturer:")
    l.grid(row=4, column=0)    
    self.fields['fk_mfactID'] = Entry(frame)
    self.fields['fk_mfactID'].grid(row=4, column=1)    
#-------------- 4th field    
    l = Label(frame, text="ModelNo:")
    l.grid(row=6, column=0)   
    self.fields['itemModelNo'] = Entry(frame)
    self.fields['itemModelNo'].grid(row=6, column=1)
 
#-------------- new field 
#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 
#-------------- 5th field  
    l = Label(frame, text="Description:")
    l.grid(row=8, column=0)   
    self.fields['description'] = Entry(frame)
    self.fields['description'].grid(row=8, column=1)
#-------------- 6th field 
    l = Label(frame, text="Last user assigned:")
    l.grid(row=10, column=0)   
    self.fields['fk_lastUserID'] = Entry(frame)
    self.fields['fk_lastUserID'].grid(row=10, column=1)
#####################################################
#####################################################    
#-------------- 7th field (RadioButton)
#checkbutton ready? YesNo 
	var = IntVar()
	self.fields['ready'] = Checkbutton(frame,variable=var)
	self.fields['ready'].var = var
	self.fields['ready'].grid(row=12, column=1)
  
#####################################################
#####################################################
#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&  
    l = Label(frame, text="PartNo:")
    l.grid(row=14, column=0)    
    self.fields['itemPartNo'] = Entry(frame)
    self.fields['itemPartNo'].grid(row=14, column=1)    
#-------------- 8th field    
    l = Label(frame, text="SerialNo:")
    l.grid(row=16, column=0)   
    self.fields['itemSerialNo'] = Entry(frame)
    self.fields['itemSerialNo'].grid(row=16, column=1)
#-------------- 9th field  
    l = Label(frame, text="Purchased PO No:")
    l.grid(row=18, column=0)    
    self.fields['fk_itemPONo'] = Entry(frame)
    self.fields['fk_itemPONo'].grid(row=18, column=1)    
#-------------- 10th field    
    l = Label(frame, text="Item Cost:")
    l.grid(row=20, column=0)   
    self.fields['itemCost'] = Entry(frame)
    self.fields['itemCost'].grid(row=20, column=1)
#-------------- 11th field  
    l = Label(frame, text="Warranty Expiration:")
    l.grid(row=22, column=0)    
    self.fields['itemWarrExp'] = Entry(frame)
    self.fields['itemWarrExp'].grid(row=22, column=1)    
#-------------- 12th field    
    l = Label(frame, text="User Assigned:")
    l.grid(row=24, column=0)   
    self.fields['fk_userID'] = Entry(frame)
    self.fields['fk_userID'].grid(row=24, column=1)
#-------------- 13th field  
    l = Label(frame, text="Loaned:")
    l.grid(row=26, column=0)    
    self.fields['loaned'] = Entry(frame)
    self.fields['loaned'].grid(row=26, column=1)    
#-------------- 14th field    
    l = Label(frame, text="Comment:")
    l.grid(row=28, column=0)   
    self.fields['comment'] = Entry(frame)
    self.fields['comment'].grid(row=28, column=1)
#-------------- 15th field    
    l = Label(frame, text="Alias:")
    l.grid(row=30, column=0)   
    self.fields['alias'] = Entry(frame)
    self.fields['alias'].grid(row=30, column=1)
#-------------- 16th field    
    l = Label(frame, text="Vendor Puchased From:")
    l.grid(row=32, column=0)   
    self.fields['fk_vendID'] = Entry(frame)
    self.fields['fk_vendID'].grid(row=32, column=1)
#-------------- 17th field    
    l = Label(frame, text="Item Location:")
    l.grid(row=34, column=0)   
    self.fields['fk_locID'] = Entry(frame)
    self.fields['fk_locID'].grid(row=34, column=1)
#-------------- 18th field    
    l = Label(frame, text="Issued to user(1, or 0):")
    l.grid(row=36, column=0)   
    self.fields['issued'] = Entry(frame)
    self.fields['issued'].grid(row=36, column=1)
                        
## END Fields ************************************************ 
 
## BEGIN Buttons ########      
    submitbtn = Button(frame, text="Insert", command=self.do_insert)
    submitbtn.grid(row=300, column=0)
#..........    
    clearbtn = Button(frame, text="Clear", command=self.do_clear)
    clearbtn.grid(row=300, column=1)
## END Buttons ##########   
    window.mainloop()
    
## Insert and Clear functions
  def do_clear(self):  
    self.fields['itemID'].delete(0,END)
    self.fields['fk_itemTypeID'].delete(0,END)
    self.fields['fk_mfactID'].delete(0,END)
    self.fields['itemModelNo'].delete(0,END)
    self.fields['description'].delete(0,END)
    self.fields['fk_lastUserID'].delete(0,END)
    self.fields['ready'].var.set(0)    ### ADDED
    self.fields['itemPartNo'].delete(0,END)
    self.fields['itemSerialNo'].delete(0,END)  
    self.fields['fk_itemPONo'].delete(0,END)
    self.fields['itemCost'].delete(0,END)
    self.fields['itemWarrExp'].delete(0,END)
    self.fields['fk_userID'].delete(0,END)
    self.fields['loaned'].delete(0,END)
    self.fields['comment'].delete(0,END)
    self.fields['alias'].delete(0,END)
    self.fields['fk_vendID'].delete(0,END)
    self.fields['fk_locID'].delete(0,END)
    self.fields['issued'].delete(0,END)
                    
  def do_insert(self):
  	global curs
	sql = "insert into item (itemID,fk_itemTypeID, fk_mfactID, itemModelNo, description, fk_lastUserID, ready, itemPartNo, itemSerialNo, fk_itemPONo, itemCost, itemWarrExp, fk_userID, loaned, comment, alias, fk_vendID, fk_locID, issued) values ('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s');"%( 
		self.fields['itemID'].get(),
		self.fields['fk_itemTypeID'].get(),
		self.fields['fk_mfactID'].get(),
		self.fields['itemModelNo'].get(),
		self.fields['description'].get(),
		self.fields['fk_lastUserID'].get(),		
		self.fields['ready'].var.get(),    ### ADDED
		self.fields['itemPartNo'].get(),
		self.fields['itemSerialNo'].get(),
		self.fields['fk_itemPONo'].get(),
		self.fields['itemCost'].get(),
		self.fields['itemWarrExp'].get(),
		self.fields['fk_userID'].get(),
		self.fields['loaned'].get(),
		self.fields['comment'].get(),
		self.fields['alias'].get(),
		self.fields['fk_vendID'].get(),
		self.fields['fk_locID'].get(),
		self.fields['issued'].get())
	
	curs.execute(sql)
	conn.commit()
	print sql
                   
if __name__=="__main__":
    MyApp()

Open in new window

item-frm.txt
0
Roger BaklundCommented:
You are mixing tabs and space indentation.  The other fields have four spaces, the "ready" field have a TAB character. Change the TAB to four spaces.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
lessthan2Author Commented:
I went through the entire form and reindented every line. You're right, I DID have spaces mixed in with tabs. I remember reading some cautionary notes about doing this.
Thank you for the help cxr
0
lessthan2Author Commented:
Caution to anyone else having strange "invalid syntax errors in a Tkinter form. MAKE SURE you either use spaces, OR tabs for indention. Don't use both in the same form.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Python

From novice to tech pro — start learning today.