Reputation: 13
def AppendModule():
Message = Label(GUIWindows.root, text="please type the ID of the module you want to append").grid(rows=6, column=0)
ModuleInput = Entry(GUIWindows.root).grid(rows=6, column=0)
ModuleInput.pack()
AcceptButton = Button(GUIWindows.root, text='Enter ID', command=ModuleInput).grid(rows=8, column=0)
e = ModuleInput.get
print(e)
So this function is suppose to prompt the user to type the name of the module in the text box and then store what the user wrote as a variable. I'm getting the error (AttritubeError: 'NoneType' object has no attribute 'pack').
So I did a bit of research and I was told to use the .pack to store the data and then use the .get to retrieve it. Though that doesn't seem to work. Any Suggestions?
Upvotes: 1
Views: 43
Reputation: 86
So, try this:
def printTextInEntry():
print(ModuleInput.get())
def AppendModule2():
global ModuleInput
Message = Label(GUIWindows.root, text="please type the ID of the module you want to append").grid(rows=6, column=0)
ModuleInput = Entry(GUIWindows.root)
ModuleInput.grid(rows=6, column=0)
AcceptButton = Button(GUIWindows.root, text='Enter ID', command=printTextInEntry)
AcceptButton.grid(rows=8, column=0)
Upvotes: 2