Skip to main content

windows drag icon & drop load.

Project description

这就是一个对 windows 桌面图标拖拽加载路径的 hook 函数。

1)本质是调用 window 内部函数实现。
2)使用时请注意不要 hook 超过两百个组件。

针对每次拖拽,可获得每次所有拖拽得到的路径 list。
针对 list 进行相应的函数挂钩处理即可。

*args:
hwnd
**kw:
func = _func
# default func just use path list print each one.
# default each full_path_file_name type: bytes
#===================
def _func(ls):
for i in ls:
print(i)
#===================
test evironment:
python3.6
work on win7 32bit & 64bit.

if you use tkinter, you can hook like this:
=================================================
> import windnd
>
> def my_func(ls):
for idx,i in enumerate(ls):
print(idx,i)
>
> import tkinter
> tk = tkinter.Tk()
> hwnd = tk.winfo_id()
>
> windnd.hook_dropfiles(hwnd,func = my_func)
>
> tk.mainloop()
=================================================

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

windnd-1.0.4.tar.gz (3.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page