NoneType Error self.widget.insert

Your problem occurs on this line:

self.text= tk.Text(self).grid()

grid doesn’t explicitly return anything, so this is effectively setting self.text = None. This value is then passed to Output.__init__ and eventually accessed in write.

Split it into two steps instead:

 self.text = tk.Text(self)
 self.text.grid()

Leave a Comment