To get the inputted text from within a Scrolltext
widget in tkinter, the same get
method is used as that of the Text
widget(similar question). The two parameters of the function are the START and the END of the text extraction. In your use case, it seems you want to fetch the entire text which can be done by extracting text from line index "1.0" to tkinter.END
, which is a constant that always points to the last line index.(for more info on line indices see this.)
get method syntax -:
widget.get("1.0", tkinter.END)
In your case it will become -:
self.scroll.get("1.0", tkinter.END)
Further, as pointed out by @furas, the pack
method should be called separately as pack returns None
, for more info refer to this thread. Fixed code for that section will be -:
self.scroll = ScrolledText.ScrolledText(self.tk)
self.scroll.pack()