Skip to content

issue with a file DnD on Windows, from external app to Python app with this library #4

Description

@TrevorMarvinPNNL

(Originally posted in python/cpython, closed there and opened here because of using this repo's library.)

Handling of a Drag-n-Drop event with tkinter causes an exception:

File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1520.0_x64__qbz5n2kfra8p0\lib\tkinter\__init__.py", line 1920, in __call__
    args = self.subst(*args)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1520.0_x64__qbz5n2kfra8p0\lib\tkinter\__init__.py", line 1605, in _substitute
    e.serial = getint(nsign)  
_tkinter.TclError: expected integer but got "%#"

The basic code used is this (more code is in the app, but this should be the relevant parts of the setup):

def drop(event):
        print("DROP EVENT:", event) # test code to see what's delivered

import tkinterDnD
root = tkinterDnD.Tk()
root.register_drop_target("*")
root.bind("<<Drop>>", drop)

The intent is to capture a file dragged from another application. With the 'register' function, this Python program and the OS indicate that the program's window is a valid place to drop a file dragged from a file manager program (specifically using Windows Explorer). After 'dropping', the error shown above is seen.

Environment:
CPython versions tested on: Python.3.10_3.10.1520.0_x64__qbz5n2kfra8p0
Operating system and architecture: Windows 10

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions