I am trying to get the name of the window currently in focus by running this code...
import win32gui
name = win32gui.GetForegroundWindow()
However, I keep getting
Traceback (most recent call last):
File "D:\Program_1\test.py", line 1, in <module>
import win32gui
ImportError: No module named win32gui
I installed pywin32 from here http://sourceforge.net/projects/pywin32/?source=navbar . What is the mistake I am making; guessing it is something very basic. Thanks in advance.
EDIT: Found the solution. I was installing a 32bit pywin32 on a 64bit Windows 7 because the 64bit version gave me an error, it could not find the Python registry. I found a solution here Python version 2.6 required, which was not found in the registry . Reinstalling Python and installing it just for myself resulted in no errors given by pywin32 64bit installation.
See this link: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pywin32. It may be of help to you.
EDIT: (easy version)
Step 1: Download the pywin32....whl
Step 2: pip install pywin32....whl
Step 3: C:\python32\python.exe Scripts\pywin32_postinstall.py -install
Step 4: python
>>> import win32gui