• Advertisement
Sign in to follow this  

[Pyhton] Screen is acting up.

This topic is 3198 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Sign in to follow this  

  • Advertisement