I'm new to tkinter and trying to figure it out. Why doesn't this work (I get "TypeError: 'NoneType' object does not support item assignment" error)?
import tkinter as tk
def show_entry_fields():
botao['text']='Hello '
master = tk.Tk()
tk.Label(master, text="First Name").grid(row=0)
tk.Label(master, text="Last Name").grid(row=1)
botao=tk.Button(master, text='Show', command=show_entry_fields).grid(row=3,
column=1,
sticky=tk.W,
pady=4)
master.mainloop()
tk.mainloop()
but this does:
from tkinter import *
tkWindow = Tk()
tkWindow.geometry('400x150')
tkWindow.title('PythonExamples.org - Tkinter Example')
def changeText():
button['text'] = 'Submitted'
button = Button(tkWindow,
text = 'Submit',
command = changeText)
button.pack()
tkWindow.mainloop()