open and shut case
Cameron Laird
claird at lairds.us
Sun Sep 26 02:08:03 EDT 2004
In article <mailman.3201.1094987518.5135.python-list at python.org>,
Erik Heneryd <erik at heneryd.com> wrote:
>Elaine Jackson wrote:
>> Can python close a web-browser window it opened itself? The window in question
>> will be displaying a webpage that resides on the local computer, which is
>> running Windows 98. Knowing a way to do this would really help me out.
>
>Not easily. I guess something like this could work, if you have Mark
>Hammonds win32 extensions installed:
>
>(very untested)
>
>import os, win32api
># start browser
>pid = os.spawnlp(os.P_NOWAIT, "iexplore.exe", "iexplore.exe",
>r"c:\blabla\hej.html")
># ...
># kill browser
>win32api.TerminateProcess(pid, 0)
.
.
.
Did this meet your needs, Ms. Jackson? If not--if there's an issue
with win32api, or you're looking to use the default browser, insofar
as that differs from iexplore.exe, or ...--there are several other
approaches to this problem.
More information about the Python-list
mailing list