-1

Using the below code to try and store the user inputs in the entry objects as variables (CIK, As_of_date, Number_of_filings, Filing). I am getting the following error:

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\tkinter\__init__.py", line 1921, in __call__
    return self.func(*args)
  File "<ipython-input-1-51f58e22bad3>", line 27, in get_entries
    CIK = CIK_Entry.get()
AttributeError: 'NoneType' object has no attribute 'get'


window = Tk()
window.title('SEC Scraper')


# Create the Header
Header = Label(text= "Filing Data Collection").grid(row=0, column=0)
# Text Inputs

CIK_Label = Label(text="CIK Number: ").grid(row=1, column=0)
CIK_Entry = Entry(window).grid(row=1, column=1)
As_of_Date_Label = Label(text="Filings as of (YYYYMMDD format): ").grid(row=1, column=2)
As_of_Date_Entry = Entry(window).grid(row=1, column=3)
Number_of_filings_Label = Label(text="Number of Filings: ").grid(row=1, column=4)
Number_of_filings_Entry = Entry(window).grid(row=1, column=5)
Filing_Type_Label = Label(text="Filing Type: ").grid(row=1, column=6)

# Filing Type Drop Down Menu https://stackoverflow.com/questions/28905984/tkinter-how-to-create-choice-box
Filing_choices = ['10-K', '10-Q', '8-K', 'S-8', 'S-1', '10-K/A', '10-Q/A', '8-K/A', 'S-8/A', 'S-1/A']
Filing_Entry = Combobox(window, width=10, values=Filing_choices).grid(row=1, column=7)

def get_entries():
    CIK = CIK_Entry.get()
    As_of_Date = As_of_Date_Entry.get()
    Number_of_filings = Number_of_filings_Entry.get()
    Filing = Filing_Entry.get()

Enter_Button = Button(window, text="Enter", command=get_entries)
Enter_Button.grid(row=1, column=8)

window.mainloop()

1 Answers1

0

I think you should call the grid method in a separate line,. In your setup, CIK_Entry refers to the return value of .grid() method, which is None.

You want it to point to the tk.Entry return value.

CIK_Entry = Entry(window)
CIK_Entry.grid(row=1, column=1)