I have created an app. It uses some database file to show its contents in a wxpython frame. Let us assume the data开发者_运维问答base file extension is .xyz. When I double-click on an .xyz file, I want to open that file in my application and call a function inside my app to process it. How can I do it in Python and in Windows.
Thanks in advance.
It is not related to Python itself, but it is Windows configuration. You have to assign file type to the application. I guess the method how you do that depends on Windows version. Here is example for Vista: http://windows.microsoft.com/en-US/windows-vista/Change-which-programs-Windows-uses-by-default
ftype and assoc will enable you to do that (reasonable) version independent way.
In your python script you may like to use argparse to parse your command line arguments (which you specified to ftype
).
精彩评论