def test_raw_input_(self): StringIO = compat.get_StringIO() msg = "success" tmp = sys.stdin sys.stdin = StringIO(msg + "\n") try: s = compat.raw_input_() self.assertEqual(s, msg) finally: sys.stdin = tmp
def test_raw_input_(self): StringIO = compat.get_StringIO() msg = 'success' tmp = sys.stdin sys.stdin = StringIO(msg + '\n') try: s = compat.raw_input_() self.failUnlessEqual(s, msg) finally: sys.stdin = tmp
def prevent_stretching(): if os.name != "nt" or sys.getwindowsversion()[0] < 6: raise NotImplementedError( 'this script requires Windows Vista or newer') if os.path.basename(sys.executable) == 'pythonw.exe': selection = 'y' else: from pygame.compat import raw_input_ selection = None while selection not in ('y', 'n'): selection = raw_input_( 'Prevent stretching? (y/n): ').strip().lower() if selection == 'y': user32 = ctypes.windll.user32 user32.SetProcessDPIAware()
try: import ctypes except ImportError: print('install ctypes from http://sourceforge.net/projects/ctypes/files/ctypes') raise import pygame # Determine whether or not the user would like to prevent stretching if os.path.basename(sys.executable) == 'pythonw.exe': selection = 'y' else: from pygame.compat import raw_input_ selection = None while selection not in ('y', 'n'): selection = raw_input_('Prevent stretching? (y/n): ').strip().lower() if selection == 'y': msg = 'Stretching is prevented.' else: msg = 'Stretching is not prevented.' # Prevent stretching if selection == 'y': user32 = ctypes.windll.user32 user32.SetProcessDPIAware() # Show screen pygame.display.init() RESOLUTION = (350, 350) screen = pygame.display.set_mode(RESOLUTION)
import ctypes except ImportError: print('install ctypes from http://sourceforge.net/projects/ctypes/files/ctypes') raise import pygame # Determine whether or not the user would like to prevent stretching if os.path.basename(sys.executable) == 'pythonw.exe': selection = 'y' else: from pygame.compat import raw_input_ selection = None while selection not in ('y', 'n'): selection = raw_input_('Prevent stretching? (y/n): ').strip().lower() if selection == 'y': msg = 'Stretching is prevented.' else: msg = 'Stretching is not prevented.' # Prevent stretching if selection == 'y': user32 = ctypes.windll.user32 user32.SetProcessDPIAware() # Show screen pygame.display.init() RESOLUTION = (350, 350) screen = pygame.display.set_mode(RESOLUTION)