Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #44493

Drag and drop in Windows

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <Robert.Flintham@uhb.nhs.uk>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'subject:Windows': 0.02; 'skip:[ 20': 0.04; 'i?m': 0.05; 'received:169.254.1': 0.05; 'binary': 0.07; 'i?ve': 0.07; 'tkinter': 0.07; 'you?d': 0.07; 'imported': 0.09; 'wrapper': 0.09; 'python': 0.11; '2.7': 0.14; 'windows': 0.15; 'appreciated!': 0.16; 'bind': 0.16; 'idx': 0.16; 'proc': 0.16; 'stumbled': 0.16; 'subject:drop': 0.16; 'tcl': 0.16; 'xppython': 0.16; 'proprietary': 0.16; 'code.': 0.18; 'variable': 0.18; 'all,': 0.19; 'bit': 0.19; 'trying': 0.19; '&lt;': 0.19; 'implementing': 0.19; 'command': 0.22; 'input': 0.22; 'import': 0.22; 'to:name :python-list@python.org': 0.22; 'error': 0.23; 'dll': 0.24; 'file.': 0.24; "i've": 0.25; 'options': 0.25; 'switch': 0.26; 'post': 0.26; 'skip:" 20': 0.27; 'don?t': 0.29; 'mode': 0.30; "i'm": 0.30; 'included': 0.31; 'url:wiki': 0.31; 'skip:? 20': 0.31; 'file': 0.32; 'this.': 0.32; 'probably': 0.32; 'received:169.254': 0.32; 'open': 0.33; 'skip:& 30': 0.33; 'skip:? 10': 0.33; 'but': 0.35; 'url:rec-html40': 0.35; 'really': 0.36; 'charset:us-ascii': 0.36; 'url:org': 0.36; 'received:169': 0.37; 'searching': 0.37; 'url:microsoft': 0.37; 'two': 0.37; 'received:10': 0.37; 'implement': 0.38; 'skip:o 20': 0.38; 'generic': 0.38; 'question,': 0.38; 'window': 0.38; 'url:office': 0.38; 'skip:[ 10': 0.38; 'whatever': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'url:schemas': 0.38; 'planning': 0.38; 'rather': 0.38; 'url:omml': 0.39; 'url:2004': 0.39; 'legally': 0.39; 'skip:& 20': 0.39; 'url:12': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'disclaimer:': 0.60; 'received:unknown': 0.61; 'information,': 0.61; 'received:62': 0.63; 'header:Message-Id:1': 0.63; 'such': 0.63; 'direct': 0.67; 'bottom': 0.67; 'email,': 0.69; 'privileged.': 0.69; 'e-mail.': 0.70; 'exclusive': 0.81; 'skip:$ 10': 0.81; 'explorer': 0.84; 'that?s': 0.84; 'recipient(s)': 0.95; 'url:tk': 0.95
From Robert Flintham <Robert.Flintham@uhb.nhs.uk>
To "python-list@python.org" <python-list@python.org>
Date Mon, 29 Apr 2013 11:25:51 +0100
Subject Drag and drop in Windows
Thread-Topic Drag and drop in Windows
Thread-Index Ac5Ew+vkfYcj8bi9TaCKw8Ot8YgvlA==
OLD-MSG-ID <DFBB66D7CAE80545A91347000FC76D5E0235A2ED54@BOURNE.xuhb.nhs.uk>
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 multipart/alternative; boundary="_000_DFBB66D7CAE80545A91347000FC76D5E0235A2ED54BOURNExuhbnhs_"
MIME-Version 1.0
X-SEF-7853D99-ADF1-478E-8894-213D316B8FFA 1
X-SEF-Processed 7_0_0_00239__2013_04_29_11_25_58
X-TM-AS-Product-Ver IMSVA-8.0.0.1467-7.0.0.1014-19830.006
X-TM-AS-Result No--38.722-60-31-10
X-imss-scan-details No--38.722-60-31-10; No--38.722-3-31-10; No--38.722-5-31-10
X-TMASE-MatchedRID dwz5Qv+5WGrdeQjqNZdjdCZm6wdY+F8KQrO4XR6BRQMZnbM1DCQfDfRm 0kmqtH+DHZ42wuMtlG2XOXSR+sVuoVxH8Dm6GqsW84dsinZ5e1hy4VFP6muDhqbGGv9dC9Uchbj XiP8vmiywQmjMkzPgDUBmhlAfq+ED02FrWs7riSAD2WXLXdz+AQkN8Uvsy+nttSlhqC3qPOhDZs GJaCDYmLJJPvchJmiFKB5B11+7y+FDPREoNRs4IxK6EFc0lvV0XEjKf9fhKafF7duWDXiFEhs46 Rwf3Ox5os9DXkHxMZ1r4j/oOfXFUnBQEhF4lroX0Xw0ILvo/uX54F/2i/DwjRC5sbPgjhvgFUc7 hcYrKS5oDyC1jJiOF3VALpStBs0q3jv4KvWrwsQAz7oVOD+dyjoSfZud5+GgmmzaGKIwUHbkhXZ 0G9JRyzba6gSbbjl+QVYK+bzrDzjSxemNC+0f0PU1Xpm2N12S/AZW18vjv1o6iP0NczjR0lvr9J ucnAavzkH/0tV77RAZttB2H+RMvwkbnmLrKdccY4guKfvwCBaPzMNXaUvE6YtSx8A+2HeKakcq2 RAHKcqFNXznDVhjDbjhwRWzN/6QMuYLNWSVlUgc9jA4mLo8uaX1XMd/SqvuKOpzudgQfQJR18Qp zXStTnic1EL5RdbnKoWa7+H+3DvMWzPfoqOdFjTR2TFg0xG3pwnFZnn+VHwaK6XhXABo9yJkpIM WHcbC92grUwQgYZcl9IJzJrAT7nMbiLLKBHkE/sToY2qzpx6SiN8MzoBQOEUYJ3RLQ0KypyBBhr A3gBwIi8x5+jfCK4DMUZ7Ecdr/rv9HEZyuwxnrpcchznD6Bw==
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1148.1367231567.3114.python-list@python.org> (permalink)
Lines 252
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1367231567 news.xs4all.nl 15909 [2001:888:2000:d::a6]:33215
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:44493

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

Hello all,

Sorry to post such a generic question, but after searching the interwebs I'm not really any wiser about how to start with this.

I'm currently on:
Windows XP
Python 2.7

I'm trying to create a small window in Python 2.7, that when you drop a file onto it from Windows explorer returns the file's path so that I can then go on to open the file and do whatever with it.  I was planning on using Tkinter because that's what I've used before for GUI's, but I can be swayed from this if needs be.

I've found this (TkDND):
http://wiki.tcl.tk/2768

But I don't know how to implement this in Python.  The Windows binary for it comes as a set of ".tcl" files and a single ".dll" file.

The two options I've stumbled across seem to be

1.  a Python wrapper for the DLL (I think to wrap C code??), which can then be imported like you'd import a Python package

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 implementing individual functions?

Any input (however minimal) is definitely appreciated!  I've included what I think are probably the relevant functions from the Tcl files at the bottom of the email, but I don't really understand the nuts and bolts of the code.

All the best,
Rob

[From "tkdnd.tcl"...]

# ----------------------------------------------------------------------------
#  Command tkdnd::drag_source
# ----------------------------------------------------------------------------
proc tkdnd::drag_source { mode path { types {} } { event 1 } } {
  set tags [bindtags $path]
  set idx  [lsearch $tags "TkDND_Drag*"]
  switch -- $mode {
    register {
      if { $idx != -1 } {
        bindtags $path [lreplace $tags $idx $idx TkDND_Drag$event]
      } else {
        bindtags $path [concat $tags TkDND_Drag$event]
      }
      set types [platform_specific_types $types]
      set old_types [bind $path <<DragSourceTypes>>]
      foreach type $types {
        if {[lsearch $old_types $type] < 0} {lappend old_types $type}
      }
      bind $path <<DragSourceTypes>> $old_types
    }
    unregister {
      if { $idx != -1 } {
        bindtags $path [lreplace $tags $idx $idx]
      }
    }
  }
};# tkdnd::drag_source


[From "tkdnd_windows.tcl"...]

# ----------------------------------------------------------------------------
#  Command olednd::_GetDragSource
# ----------------------------------------------------------------------------
proc olednd::_GetDragSource {  } {
  variable _drag_source
  return $_drag_source
};# olednd::_GetDragSource
DISCLAIMER:
This email and any attachments hereto contains proprietary information, 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 or transmission error has misdirected this e-mail and you are not the intended recipient(s), please notify the author by replying to this e-mail. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this e-mail or any attachments, as this may be unlawful.

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Drag and drop in Windows Robert Flintham <Robert.Flintham@uhb.nhs.uk> - 2013-04-29 11:25 +0100
  Re: Drag and drop in Windows Christian Gollwitzer <auriocus@gmx.de> - 2013-04-29 22:38 +0200
  RE: Drag and drop in Windows Robert Flintham <Robert.Flintham@uhb.nhs.uk> - 2013-04-30 09:39 +0100
    Re: Drag and drop in Windows Christian Gollwitzer <auriocus@gmx.de> - 2013-04-30 14:08 +0200
  Re: Drag and drop in Windows Kevin Walzer <kw@codebykevin.com> - 2013-04-30 10:33 -0400
  Re: Drag and drop in Windows Kevin Walzer <kw@codebykevin.com> - 2013-04-30 19:09 -0400
  RE: Drag and drop in Windows Robert Flintham <Robert.Flintham@uhb.nhs.uk> - 2013-05-01 09:06 +0100
    Re: Drag and drop in Windows Christian Gollwitzer <auriocus@gmx.de> - 2013-05-01 10:25 +0200

csiph-web