(See python - tkinter "scrolledtext" copy paste doesn't work reliably - Stack Overflow for a temporary fix solution).
I have found a behaviour which seems to be a bug in
If you run the following code:
import tkinter, tkinter.scrolledtext root = tkinter.Tk('test') text = tkinter.scrolledtext.ScrolledText(master=root, wrap='none') text.pack(side="top", fill="both", expand=True, padx=0, pady=0) text.insert(tkinter.END, 'abc\ndef\nghi\nijk') root.mainloop()
- select one row in the
scrolledtextwidget, e.g. the row “ghi”,
- copy it with CTRL+C
- do nothing else and close the app
Then paste it (CTRL+V) in any other Windows app: it won’t work, nothing will be pasted. The content of the clipboard is deleted when the tkinter window is closed, which is NOT the Windows standard.
Indeed, the expected behaviour is that text copied with CTRL+C should persist in the clipboard even if the app is closed. This is the default behaviour in many Windows software. Example here with
link to the animated screen capture: https://i.imgur.com/li7UvYw.mp4