Python: Matplotlib open interactive figures
<p>since I like the interactive figures of matlab (*.fig). I wrote a small program for saving interactive figures in Python.  I use pickle to dump a matplotlib.pyplot figure in a name.pyfig file:</p>

<pre><code>    output = open('name.pyfig', 'wb')
    pickle.dump(plt.gcf(), output)
    output.close()
</code></pre>

<p>To open the figure I use:</p>

<pre><code>    f = open('name.pyfig','rb')
    pickle.load(f)
    f.close()
</code></pre>

<p>Now I'd like to implement the following: I want to open the figure by double clicking on the name.pyfig file in the windows file explorer.</p>

<p>Since name.pyfig only contains the data of the figure, I wrote a python script openfig.py to open the figure by using </p>

<pre><code>    python openfig.py name.pyfig
</code></pre>

<p>in CMD which is working quite well. To be able to run the openfig.py by double-clicking on the pyfig file I associate the pyfig extension with a bat file (open with - choose default program) calling the code from above which is also working, as long as the bat file is in the same folder! For some reason, it is not possible to select the bat file as default program for the pyfig file if it is located somewhere else!</p>

<p>Any solution?
Ge</p>

<p>System:
Python Version 2.7.9
Win 7 Enterprise</p>

<p>Nevermind, I manually added a registry entry which worked fine:</p>

<pre><code>    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\pyfig_auto_file]
    @=""

    [HKEY_CLASSES_ROOT\pyfig_auto_file\DefaultIcon]
    @="path_to_ico_file"

    [HKEY_CLASSES_ROOT\pyfig_auto_file\shell]

    [HKEY_CLASSES_ROOT\pyfig_auto_file\shell\open]

    [HKEY_CLASSES_ROOT\pyfig_auto_file\shell\open\command]
    @="\"path_to_bat_file\"\"%1\""
</code></pre>

<p>Ge</p>

python matplotlib save interactive figure