1

I have images in 100 folders and the search results are slow, so I want to access those images, so maybe I wanna do it with python(if it is faster), in the way that when we select all the files, and drag and drop them in windows. then I realized that drag and drop in windows uses Component Object Model this source.

So I want to know is there any way in python to have COMs of the image files in those 100 folders in the same place (a specific folder)? or in other words can we create COMs of other files, (equivalent of shortcuts), cause I know shortcuts for my purpose won't work.

The question in general is about how to access direct handles or COMs of files of different folders in one folder? if it's possible, please tell me how? to be simpler I want to have similar function of file shortcuts but not 'shortcuts' existing in windows, because for my purpose 'shortcuts' won't work, so I think it can be done with COMs.

tkinter equivalent question: let me ask my question in other way, lets think I want to make a windows file search application in python with some library like tkinter, so one background part of my code finds the file paths of desired search results, and other part in gui('gui part'): wants to show the result files with ability of opening files from that gui or drag files from gui to other folder or applications, so how should I do the 'gui part'?

this tutorial suggested by @Thingamabobs is about getting external files into window(gui) of app, but I want the opposite, I mean having file handles to open, something like windows explorer

My question maybe wrong in case of misunderstanding the concept of COMs, so please provide me more relevant sources of use case of mine. finally if the title seems to be unsuitable, feel free to change it.

16
  • Why do you want to use COM and not simply file operations? Commented Mar 3, 2022 at 21:36
  • @Corralien I didnt get ur question? is there any other way to drag images from 100 folders and drop it to some image viewer app? Commented Mar 3, 2022 at 21:42
  • I'm sorry, I missed the part "Image viewer app"! Commented Mar 3, 2022 at 21:45
  • 1
    See this tutorial Commented Mar 3, 2022 at 22:53
  • 2
    Does this answer your question? How to Install and Use TkDnD with Python Tkinter on OSX? Commented Mar 3, 2022 at 22:57

1 Answer 1

2

Based on an interpretation of the question, the following is an initial summary approach to a solution.

"""
This module will enable easy access to files spread across 100 plus
directories. A file should be as easy to open as clicking on a link.

Analysis:
Will any files be duplicated in any other directory? Do not know.
Will any file name be the same as another file in a different directory? Do
not know.

Initial design in pseudocode:
> Capture absolute path to each file in each directory.
> Store files information in python data structure
    > for instance a list of tuples <path>,<filename>
> Once a data structure is determined use Tkinter, ttk.treeview to open a
file as easy as clicking on a link in the tree.
"""
Sign up to request clarification or add additional context in comments.

4 Comments

ttk.treview can be configured to click on an item in the tree to execute a command. The command can be a file open command.
sorry can it be used for mass file drag and drop? last comment was a mistake.
Mass file drag and drop could be done from treeview. But there might be better (faster, better interface) alternatives. My pseudo design emphasized approximating, "The question in general is about how to access direct handles or COMs of files of different folders in one folder?"
can you provide the code for the treeview and the link part

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.