在 Python/wxPython 中访问文件元数据
我想编写一个实现 wx.FileDropTarget 的 Python/wxPython 应用程序。这部分很简单。我还想在将文件图标拖到应用程序窗口上时显示文件图标,然后在应用程序窗口中显示带有文件图标(以及其他元数据,可能如大小)的代理。
我想在 Windows 7 上实现此功能。但我有兴趣能够在 OS X 和 Linux 上实现此功能。
我用谷歌搜索并搜索了 Python v2.7.1 文档 - 但没有结果。我对 Windows 的方式有点陌生,所以如果有一种方法可以预测与文件关联的 BMP 或 ICO 文件 - 那么我可以走这条路...
任何示例代码总是值得赞赏的。
I would like to write a Python/wxPython app that implements wx.FileDropTarget. This part is easy. I would also like to show the file icon as it is dragged over the app window and then display a proxy with file icon (and other meta-data, perhaps, like size) within the app window.
I would like to implement this on Windows 7. But I am interested in being able to make this work on OS X and Linux as well.
I have googled and searched through Python v2.7.1 documentation - but to no avail. I am somewhat new the ways of Windows, so if there is a way to divine a BMP or ICO file that is associated with a file - then I am okay with going that route...
Any example code is always appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为不仅有一种便携式方法可以完成此任务...在 Windows 平台上,文件类型关联的默认图标存储在系统注册表中(图标位于 exe 资源中的可执行文件除外),而在 Linux 平台上,它依赖于桌面环境,每个都有自己的标准......所以我认为没有一种“通用”方法可以做到这一点。
I think there's not only one portable way to accomplish this ... on windows platforms, default icons for file types associations are stored on the system registry (except for executables where the icon is in the exe resources) and on linux platforms it depends on the desktop environment, each one has its own standards ... so i don't think there's an "universal" way to do that.
这个示例应该可以帮助您开始在 Windows 中查找文件图标:
%ProgramFiles%\Internet Explorer\iexplore.exe,-17 2
...至少在我的系统上是这样。
This example should get you started for finding file icons in windows:
%ProgramFiles%\Internet Explorer\iexplore.exe,-17 2
...at least that's what it is on my system.