Sign in to follow this  

[Pyhton] Screen is acting up.

Recommended Posts

Whenever I load the program, even though i have it set to a white background, if shows up black, when i exit the program it shows the white background and the red line drawn can someone help me?
import pygame

def drawStuff(background):
	pygame.draw.line(background, (255,0,0), (5,100), (100,100))
def main():
	screen = pygame.display.set_mode((640,480))
	pygame.display.set_caption("Drawing Module")
	background = pygame.Surface(screen.get_size())
	background = background.convert()
	clock = pygame.time.Clock()
	run = True
	while run:
		for event in pygame.event.get():
			if event.type == pygame.QUIT:
				run = False	
			elif event.type == pygame.MOUSEBUTTONUP:
				print pygame.mouse.get_pos()
	screen.blit(background, (0,0))
if __name__ == "__main__":

Share this post

Link to post
Share on other sites
Your blit and display flip calls are done outside - and after - the while loop. Indent them some more so they fall within the while loop scope.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this