get a list of open applications python

import win32gui

def winEnumHandler( hwnd, ctx ):
    if win32gui.IsWindowVisible( hwnd ):
        print (hex(hwnd), win32gui.GetWindowText( hwnd ))

win32gui.EnumWindows( winEnumHandler, None )

Here is what the above code is Doing:
1. winEnumHandler is a function that is passed to EnumWindows.
2. hwnd is a handle to a window.
3. ctx is a user context.
4. IsWindowVisible checks if the window is visible.
5. GetWindowText gets the window title.
6. EnumWindows enumerates all top-level windows on the screen.