> On 2017-05-01, at 12:09, Michael Lange <klappn...@web.de> wrote: > > Hi, > > On Mon, 1 May 2017 11:12:43 -0600 > Bob Greschke <b...@passcal.nmt.edu> wrote: > >> We have a Python/Tkinter inventory program that I wrote that users >> access using X-Windows (Xming, XQuartz, etc.). It can't directly access >> files on the users computer, of course, but cutting and pasting text >> into a Toplevel with a text widget in it does make that text available >> to the program. You can hit a Save button, the program will read the >> Text() and save it to the database, for example. >> >> Could the same thing be done with a .gif or a .pdf file? If there was a >> Toplevel that was designed for dragging and dropping .gif/.png files >> to, could it "interpret" the dragged stuff in such a way that it could >> then take the info and turn it into let's say uuencode, display that in >> the window, then when the user hits a Save button that uuencoded text >> gets read, run through PhotoImage and saved in the database? > > for drag and drop you might try the tkdnd wrapper from > http://tkinterdnd.sourceforge.net/ > (it's pretty old Python2-code; from a quick glance I think that changing > the import line from > import Tkinter > into something like > try: > import Tkinter > except ImportError: > import tkinter as Tkinter > might be all that is needed to make it work with Python3 though) > With the tkdnd test script I can drop a bunch of filenames from Xfe onto a > Tk window here (Debian Jessie). However I am not sure if this helps you > any, since of course these files would still have to be read... > > Regards > > Michael
Hi Michael! Yeah, quickly searching went right to tkdnd. We're still Python2, so no problem there. I'm starting to think that copy and paste into a window may be the only option, but I'm not sure what Xming/XQuartz will do with the file. Oh, well, I Command-C'ed a text file on my Mac to a Toplevel in the program with Ctrl-V and the file name was typed in the Text(). That's cute. :) "Paste" didn't even show up in the XQuartz Edit menu after the Command-C. This may just not be possible. I guess I could give everyone a little utility that produces a uuencode'd file from their .gif, or whatever, on their Desktop, and then they copy and paste the contents of that into a program's Toplevel/Text() after opening it with their favorite text editor. Then select a menu item to suck in whatever it was they pasted. Are users that smart? Dang. ;) Thanks! _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org https://mail.python.org/mailman/listinfo/tkinter-discuss