Sign in to follow this  

[Pyhton] Screen is acting up.

This topic is 3103 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
pygame.init()

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()
	background.fill((255,255,255))
	
	drawStuff(background)
	
	clock = pygame.time.Clock()
	run = True
	
	while run:
		clock.tick(30)
		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))
	pygame.display.flip()
	
if __name__ == "__main__":
	main()
		


Share this post


Link to post
Share on other sites

This topic is 3103 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.

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