PIL + show() + Vista
Tim Golden
mail at timgolden.me.uk
Fri Nov 30 05:34:53 EST 2007
Méta-MCI (MVP) wrote:
> Re!
>
> I have found the problem. On Vista, the Windows-Photo-Galery (soft
> default displayer) don't wait. Even with START /WAIT (in Image.py &
> _showxv), it don't wait.
>
> Then, like the preview don't wait, the (next) "DEL" run prior the end of
> the launch of the software ; and Windows-Photo-Galery don't found the
> file...
>
> I don't have a good solution. For force view of image, it's possible to
> delete the "DEL /F %s" part ; but that will involve many BMP/temporary
> files.
I was going to suggest using FindExecutable to find out whatever
your system uses to show pictures... but then I tried it out and
found out that the association is actually via the shimgvw DLL.
So I suppose you'll have to special-case that.
<code>
import win32api
import subprocess
filepath = r"c:\temp\test.jpg"
res, exe = win32api.FindExecutable (filepath)
if exe.endswith ("shimgvw.dll"):
cmd = "rundll32.exe %s,ImageView_Fullscreen %s" % (exe, filepath)
else:
cmd = "%s %s" % (exe, filepath)
subprocess.call (cmd)
</code>
On my XP machine this waits for the ImageViewer to return.
Be interesting to see if that's different under Vista. At
least it offers you a little more control, perhaps?
TJG
More information about the Python-list
mailing list