platform-independent image copy/paste with Tkinter?

technocake robin.garen at gmail.com
Sat May 15 10:56:31 EDT 2010


Hi.

Is there a good way to copy from or paste to the clipboard on all
systems running python using Tkinter?
started a small road too it here:

#!/usr/bin/python
__author__="technocake"
__date__ ="$15.mai.2010 15:53:39$"

from Tkinter import *

if __name__ == "__main__":

    def displayClipboard(event):
        try:
            data = event.widget.clipboard_get(type="STRING")
        except :
            #Need a method for displaying a image here..
            data = "Image" #
        finally: #Updates the textlabel
            lbl.config(text=data)

    root = Tk()
    lbl= Label(root, width=20)
    lbl.bind("<Button-1>", displayClipboard) #binding to leftclick
    lbl.pack()

    root.mainloop()




More information about the Python-list mailing list