Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'subject:Windows': 0.02; 'tutorial': 0.03; 'argument': 0.05; 'received:169.254.1': 0.05; 'retrieved': 0.05; 'root': 0.05; 'binary': 0.07; 'interpreter.': 0.07; 'none,': 0.07; 'suppose': 0.07; 'tkinter': 0.07; 'append': 0.09; 'none)': 0.09; 'assume': 0.14; 'windows': 0.15; '"register': 0.16; 'accepts': 0.16; 'bind': 0.16; 'braces': 0.16; 'coupling': 0.16; 'disclaimers': 0.16; 'drag': 0.16; 'expecting': 0.16; 'mechanism.': 0.16; 'robert,': 0.16; 'side.': 0.16; 'skip:" 70': 0.16; 'skip:[ 60': 0.16; 'skip:{ 40': 0.16; 'subfolder': 0.16; 'subject:drop': 0.16; 'tcl': 0.16; 'tkinter.': 0.16; 'files.': 0.16; 'folder': 0.16; 'proprietary': 0.16; 'library': 0.18; 'bit': 0.19; 'implementing': 0.19; 'message-----': 0.19; 'widget': 0.19; 'not,': 0.20; 'work,': 0.20; 'seems': 0.21; '(the': 0.22; 'import': 0.22; 'to:name:python- list@python.org': 0.22; 'load': 0.23; 'error': 0.23; 'dll': 0.24; 'file.': 0.24; "i've": 0.25; 'script': 0.25; 'skip:" 30': 0.26; 'code:': 0.26; 'header:In-Reply-To:1': 0.27; 'to:2**1': 0.27; 'tried': 0.27; 'correct': 0.29; 'robert': 0.30; "i'm": 0.30; 'url:mailman': 0.30; 'url:wiki': 0.31; 'file': 0.32; 'received:169.254': 0.32; 'run': 0.32; 'url:python': 0.33; '(most': 0.33; 'skip:# 10': 0.33; 'comment': 0.34; 'skip:_ 10': 0.34; 'maybe': 0.34; 'skip:d 20': 0.34; "can't": 0.35; 'something': 0.35; 'usual': 0.35; 'test': 0.35; 'but': 0.35; 'there': 0.35; 'i.e.': 0.36; 'url:listinfo': 0.36; 'charset:us- ascii': 0.36; 'thanks': 0.36; 'url:org': 0.36; 'should': 0.36; 'received:169': 0.37; 'virtual': 0.37; 'email addr:python.org': 0.37; 'level': 0.37; 'received:10': 0.37; 'step': 0.37; 'christian': 0.38; 'implement': 0.38; 'auto': 0.38; 'generic': 0.38; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'skip:- 10': 0.38; 'rather': 0.38; 'recent': 0.39; 'legally': 0.39; 'does': 0.39; 'subject:': 0.39; "couldn't": 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'url:mail': 0.40; 'how': 0.40; 'disclaimer:': 0.60; 'event.': 0.60; 'skip:y 20': 0.60; 'then,': 0.60; 'received:unknown': 0.61; 'information,': 0.61; 'first': 0.61; 'received:62': 0.63; 'header:Message-Id:1': 0.63; 'name': 0.63; 're:': 0.63; 'field': 0.63; 'more': 0.64; 'account': 0.65; 'distance': 0.65; 'email name:python-list': 0.65; 'invalid': 0.68; 'privileged.': 0.69; 'e-mail.': 0.70; 'exclusive': 0.81; 'case?': 0.84; 'christian.': 0.84; 'guts': 0.84; 'pad': 0.84; 'typically,': 0.84; 'recipient(s)': 0.95; 'url:tk': 0.95; '2013': 0.98 From: Robert Flintham To: 'Christian Gollwitzer' , "python-list@python.org" Date: Tue, 30 Apr 2013 09:39:43 +0100 Subject: RE: Drag and drop in Windows Thread-Topic: Drag and drop in Windows Thread-Index: Ac5FGhbiXdXTSlYdRPWnePbL38E0bAAYziSg OLD-MSG-ID: References: <20130429204237.52A8F448266@nhs-pd1e-esg007.ad1.nhs.net> In-Reply-To: <20130429204237.52A8F448266@nhs-pd1e-esg007.ad1.nhs.net> Accept-Language: en-US, en-GB Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US, en-GB Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-SEF-7853D99-ADF1-478E-8894-213D316B8FFA: 1 X-SEF-Processed: 7_0_0_00239__2013_04_30_09_39_49 X-TM-AS-Product-Ver: IMSVA-8.0.0.1467-7.0.0.1014-19832.006 X-TM-AS-Result: No--31.126-60-31-10 X-imss-scan-details: No--31.126-60-31-10; No--31.126-3-31-10; No--31.126-5-31-10 X-TMASE-MatchedRID: EoCNt5v31Dq+J2V2/n6KGeYAh37ZsBDCc3ewuwbSaG6YjVGk//6gyRux rpr/pUL/Az8TvINBEuBLF16JzzXMTjT7rmcnNv1sj1RGQOB2Vvlu+Tj21kVZY8eQfu6iwSfsekW kqRyavwA/0gN+AWs2fwgujc5raJdwx6b5UrcphDpPuMJi/ZAk8RkqnRJng/51TliRpURm/BKSNT lFDhS1gP/sDS9b51M9FyCVjv7dlo5OnGmDpYr7R8SaVcOEb3Zct3aeg7g/usBeNs5tWYvjCaavl IwR6/83OKjcIhHUkSZSHwKg482PEGJqIuHqFLYoMAuD+BTmZchPn74Ug5EKEHLLhex0FFibcbcg OSSPsBdyKbXcsoQTsNQTMO5G6F0o06P6nK44odA0uZ5aG4kmrvngX/aL8PCNMMn1rcqKQagCMTN 4O+16f/iiQ0ugCAbYUBNTWj7/a74rQ4Lf8bCdwZPf7FSKi4gAENswxezu/44zs7oxv6pPAbe25A mPxvRo/DKheHzPEGKo8iTRLP4F3n+OhC1J6Q0szq/P2v00iKOr3d1rmRdCgBYvYmBVVNAYCf2h9 A2gFAWvExSmuBldGksoDo7ne8USyTBgz6hl0dd7sw7yO+Y9LO0DrqzpLK29lpyqxIUg/ZQL4KbF 8qbADItWcC0zAi54vECLuM+h4RB+3BndfXUhXQ== X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 61 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1367311190 news.xs4all.nl 15968 [2001:888:2000:d::a6]:38635 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:44533 Thanks Christian.=0D=0A=0D=0AI've tried the following code:=0D=0A##########= ######=0D=0Aimport Tkinter=0D=0A=0D=0Aroot =3D Tkinter.Tk()=0D=0Aroot.title= ("DICOM Opener")=0D=0Aroot.tk.eval('lappend auto=5Fpath {K:/Python27/Lib/si= te-packages/tkdnd2.6}')=0D=0Aroot.tk.eval('package require tkdnd')=0D=0A###= #############=0D=0A=0D=0ABut I get the following traceback:=0D=0A##########= ######=0D=0ATraceback (most recent call last):=0D=0A File "K:\eclipse\plug= ins\org.python.pydev=5F2.7.1.2012100913\pysrc\pydevd.py", line 1397, in =0D=0A debugger.run(setup['file'], None, None)=0D=0A File "K:\ecli= pse\plugins\org.python.pydev=5F2.7.1.2012100913\pysrc\pydevd.py", line 1090= , in run=0D=0A pydev=5Fimports.execfile(file, globals, locals) #execute = the script=0D=0A File "K:\PROGRAMMING\mripy\dicom=5Fopener.py", line 7, in= =0D=0A root.tk.eval('package require tkdnd')=0D=0A=5Ftkinter.Tc= lError: couldn't load library "K:/Python27/Lib/tkdnd2.6/tkdnd26.dll": inval= id argument=0D=0A################=0D=0A=0D=0AIs "invalid argument" as gener= ic as it sounds, or does it mean something specific in this case=3F Is Tcl= expecting an additional argument in the 'package require' line=3F=0D=0A=0D= =0AI assume the append auto path line is correct as it seems to have found = the DLL (presumably from pkgIndex.tcl).=0D=0A=0D=0AApologies for any discla= imers that pad out this message - it's a work email account and they get ad= ded after I hit "send".=0D=0A=0D=0AAll the best,=0D=0ARob=0D=0A=0D=0A-----O= riginal Message-----=0D=0AFrom: Python-list [mailto:python-list-bounces+rob= ert.flintham=3Duhb.nhs.uk@python.org] On Behalf Of Christian Gollwitzer=0D=0A= Sent: 29 April 2013 21:38=0D=0ATo: python-list@python.org=0D=0ASubject: Re:= Drag and drop in Windows=0D=0A=0D=0AHi Robert,=0D=0A=0D=0AAm 29.04.13 12:2= 5, schrieb Robert Flintham:=0D=0A> I've found this (TkDND):=0D=0A>=0D=0A> h= ttp://wiki.tcl.tk/2768=0D=0A > But I don't know how to implement this in Py= thon. The Windows binary > for it comes as a set of ".tcl" files and a si= ngle ".dll" file.=0D=0A > 2.direct implementation of the Tcl file [tk.eval(= 'source ...')], but I > don't reallu understand what's going on with this = - can you only execute > a "main" bit of Tcl files rather than implementin= g individual functions=3F=0D=0A=0D=0AI can only comment on the Tcl side, si= nce I'm not an expert in the Tkinter coupling mechanism. TkDND is indeed th= e way to go if you want native drag'n'drop support. The first step would in= deed be to load the package into the Tcl interpreter. You need to:=0D=0A=0D= =0A1) Create a folder for the packages, put the files in a subfolder Typica= lly, this is something like lib/tkdnd, and at that level there must be the = "pkgIndex.tcl" file=0D=0A2) Append the lib/ folder to the auto path tk.eval= ('lappend auto=5Fpath {mypath/lib}') (the braces are Tcl's quoting mechanis= m)=0D=0A3) load the package=0D=0Atk.eval('package require tkdnd')=0D=0A=0D=0A= Then, you need to "register the target", i.e. declare a widget that it acce= pts files. Here, you need the Tk path name of the widget, which is retrieve= d by =5F=5Fstr=5F=5F:=0D=0A=0D=0Atk.eval('tkdnd::drop=5Ftarget register ' += yourwidget +' *')=0D=0A=0D=0AThen, if you drop something, the widget recie= ves a virtual event <> . Now this is tricky, I don't know= how to bind to that event. Following the tutorial for Tcl on http://wiki.t= cl.tk/36708, I suppose something like=0D=0A=0D=0A=09yourwidget.bind("<>", filesdropped)=0D=0A=0D=0Ashould in principle work, but ho= w to get the data out of it=3F It is stuffed into the %D bind substitution.= Usual events store the MouseWheel distance in this field; so maybe you can= get it from the field event.delta. I can't test it now, but I am a bit ske= ptical whether this works with the guts of TkInter. If not, you'd need to d= o some more forwarding from the Tcl side.=0D=0A=0D=0A=09Christian=0D=0A--=0D= =0Ahttp://mail.python.org/mailman/listinfo/python-list=0D=0A=0D=0ADISCLAIME= R:=0D=0AThis email and any attachments hereto contains proprietary informat= ion, some or all of which may be confidential or legally privileged. It is = for the exclusive use of the intended recipient(s) only. If an addressing o= r transmission error has misdirected this e-mail and you are not the intend= ed recipient(s), please notify the author by replying to this e-mail. If yo= u are not the intended recipient you must not use, disclose, distribute, co= py, print, or rely on this e-mail or any attachments, as this may be unlawf= ul.=0D=0A