def get_text_from_clipboard(): # get the clipboard clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) # read the text from the clipboard text = clipboard.wait_for_text() return text