Mercurial > pygame
changeset 3142:d2c7ea748801
fix for issue #31 (pygame.error: No available video device)
| author | Temp User@jmmdesk4 |
|---|---|
| date | Thu, 26 Jul 2012 07:18:19 -0500 |
| parents | bf4bafb1a51f |
| children | e296ada67fad |
| files | lib/__init__.py |
| diffstat | 1 files changed, 10 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/__init__.py Wed Jul 25 03:53:45 2012 -0500 +++ b/lib/__init__.py Thu Jul 26 07:18:19 2012 -0500 @@ -43,29 +43,33 @@ # 3 (VER_PLATFORM_WIN32_CE) Windows CE if sys.getwindowsversion()[0] == 1: - # To interpret DirectX version numbers, see this page: - # http://en.wikipedia.org/wiki/DirectX#Releases + import _winreg + try: - import _winreg - # Get DirectX version from registry key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Microsoft\\DirectX') dx_version_string = _winreg.QueryValueEx(key, 'Version') - minor_dx_version = int(dx_version_string.split('.')[1]) + key.Close() # Set video driver to directx if DirectX 5 or better is # installed. + # To interpret DirectX version numbers, see this page: + # http://en.wikipedia.org/wiki/DirectX#Releases + minor_dx_version = int(dx_version_string.split('.')[1]) if minor_dx_version >= 5: os.environ['SDL_VIDEODRIVER'] = 'directx' # Clean up namespace - del _winreg, key, dx_version_string, minor_dx_version + del key, dx_version_string, minor_dx_version except: pass + # Clean up namespace + del _winreg + # when running under X11, always set the SDL window WM_CLASS to make the # window managers correctly match the pygame window. elif 'DISPLAY' in os.environ and not 'SDL_VIDEO_X11_WMCLASS' in os.environ:
