Drag and drop in Windows

Christian Gollwitzer auriocus at gmx.de
Tue Apr 30 08:08:05 EDT 2013


Hi Robert,

Am 30.04.13 10:39, schrieb Robert Flintham:
> Thanks Christian.
>
> I've tried the following code: ################ import Tkinter
>
> root = Tkinter.Tk() root.title("DICOM Opener") root.tk.eval('lappend
> auto_path {K:/Python27/Lib/site-packages/tkdnd2.6}')
> root.tk.eval('package require tkdnd') ################
>
> But I get the following traceback: ################
> _tkinter.TclError: couldn't load library
> "K:/Python27/Lib/tkdnd2.6/tkdnd26.dll": invalid argument
> ################
>
> Is "invalid argument" as generic as it sounds, or does it mean
> something specific in this case?  Is Tcl expecting an additional
> argument in the 'package require' line?
>
> I assume the append auto path line is correct as it seems to have
> found the DLL (presumably from pkgIndex.tcl).

Yes, actually this means the the "package require" in principle succeeds 
to perfrom the necessary steps. The EINVALID on Windows in most cases 
menas, that the DLL has the wrong word size. I.e., you run Tcl in 32 bit 
and try to load tkdnd-DLL with 64 bit or vice versa. You can get the 
bitsize from Tcl with

	"set tcl_platform(pointerSize)"
If it tells 4, Tcl runs on 32bit, if 8, it runs on 64bit.

The second problem might be, that the tkdnd.dll depends on some other 
DLL which can't be found by Windows. To debug this, install a tool like 
"Dependency walker". I don't use Windows anymore, so my memory might be 
diffuse.

	Christian



More information about the Python-list mailing list