def lock_window(windowlock): if Pywin and not autotest and not windowlock: windowlock=True hwnd = win32console.GetConsoleWindow() if hwnd: hMenu = win32gui.GetSystemMenu(hwnd, 0) if hMenu: win32gui.DeleteMenu(hMenu, win32con.SC_CLOSE, win32con.MF_BYCOMMAND) return windowlock
lprint('') # spacer #delete tempdir try: shutil.rmtree(tempdir) except: pass # silent lprint('done\n') sys.stderr.close() # close logfile #reenable console windows close button if pywin32_installed: try: hwnd = win32console.GetConsoleWindow() hMenu = win32gui.GetSystemMenu(hwnd, 1) win32gui.DeleteMenu(hMenu, win32con.SC_CLOSE, win32con.MF_BYCOMMAND) except: pass #silent #pause if Interactive: if sys.platform == "win32": os.system("pause") # windows else: #os.system('read -s -n 1 -p "Press any key to continue...\n"') import termios print("Press any key to continue...") fd = sys.stdin.fileno() oldterm = termios.tcgetattr(fd) newattr = termios.tcgetattr(fd) newattr[3] = newattr[3] & ~termios.ICANON & ~termios.ECHO termios.tcsetattr(fd, termios.TCSANOW, newattr)