import os
import sys
import traceback

#"pip install pygame-ce"
with open( os.devnull, "w" ) as f:
	oldstdout=sys.stdout; sys.stdout=f; import pygame; sys.stdout=oldstdout



if sys.platform in ( "win32", "win64" ):
	os.environ["SDL_VIDEO_CENTERED"] = "1"

pygame.display.init()
pygame.font.init()



WINDOW_RES = [ 1024, 768 ]

icon=pygame.Surface((32,32)); icon.set_colorkey((0,0,0)); pygame.display.set_icon(icon)
pygame.display.set_caption("[Program] - [Author] - [Version] - [Date]")

surface = pygame.display.set_mode(WINDOW_RES)



def get_input():
	keys_pressed = pygame.key.get_pressed()
	mouse_buttons  = pygame.mouse.get_pressed()
	mouse_position = pygame.mouse.get_pos    ()
	mouse_rel      = pygame.mouse.get_rel    ()

	for event in pygame.event.get():
		if   event.type == pygame.QUIT: return False
		elif event.type == pygame.KEYDOWN:
			if   event.key == pygame.K_ESCAPE: return False

	return True

def draw():
	pygame.display.flip()

def main():
	clock = pygame.time.Clock()
	while True:
		if not get_input(): break
		draw()

		clock.tick()
		#print( clock.get_fps() )

	pygame.quit()

if __name__ == "__main__":
	try:
		main()
		#import cProfile; cProfile.run("main()",sort="tottime")
	except:
		traceback.print_exc()
		pygame.quit()
		input()
