I’m trying to plot signals picked up from a microcontroller. I’ve had problems with port names and now I have this problem that I simply cannot find a solution to.
Here is the full error message:
Traceback (most recent call last):
File "/opt/anaconda3/lib/python3.11/tkinter/__init__.py", line 1948, in __call__
return self.func(*args)
^^^^^^^^^^^^^^^^
File "/opt/anaconda3/lib/python3.11/tkinter/__init__.py", line 864, in callit
self.deletecommand(name)
File "/opt/anaconda3/lib/python3.11/tkinter/__init__.py", line 697, in deletecommand
self._tclCommands.remove(name)
^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'remove'
And this is the part of the code which probably contains the problem:
if __name__ == '__main__':
root = tk.Tk()
# Window
root.title('XXX')
root.geometry('500x250')
root.resizable(False, False)
# Widget
button1 = tk.Button(root, text='Start', width=6, height=4, font=('Arial', 25),
cursor='hand2', bg='gray', command=lambda: main(button1))
button1.pack(padx=20, pady=0, side=tk.RIGHT)
label1 = tk.Label(root, font=('Arial', 15), text='')
label1.place(x=20, y=140)
label2 = tk.Label(root, font=('Arial', 15), text=' COM:')
label2.place(x=20, y=40)
label3 = tk.Label(root, font=('Arial', 15), text='')
label3.place(x=20, y=180)
entry = tk.Entry(root, font=('Arial', 15), width=3)
entry.place(x=140, y=40)
entry.insert(tk.END, '128')
root.mainloop()
I thought the issue was the way the ‘main’ function was being called as the command for the button.
I have tried command = main, command = main(), command=lambda: main(button1) and I still get the same problem.
Guy-Louis Mascia is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.