Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
TrevorMarvinPNNL opened this issue Jul 15, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@TrevorMarvinPNNL
Copy link

(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

@rdbende
Copy link
Owner

rdbende commented Jul 15, 2022

Thanks for reporting this! I'll definitely look into it when I have acces to some Windows.

@rdbende rdbende added the bug Something isn't working label Jul 15, 2022
@rdbende
Copy link
Owner

rdbende commented May 6, 2023

Happens on macOS as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants