Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is Pygame coming up as a black screen
    primarykey
    data
    text
    <p>Ok so basically the screen comes up wanting my name input and when I enter it the pygame window opens up however when it does it is just a black screen and it does not come up with an error either. Any ideas guys? :)</p> <pre><code>import time import random`enter code here` import pygame from pygame import* pygame.init() myname=input('What is your name') #set the window size window= pygame.display.set_mode((800,600) ,0,24) pygame.display.set_caption("Fruit Catch") #game variables myscore=0 mylives=3 mouth_x=300 fruit_x=250 fruit_y=75 fruitlist=['chicken.gif','broccoli.gif'] #prepare for screen myfont=pygame.font.SysFont("Britannic Bold", 55) label1=myfont.render(myname, 1, (240, 0, 0)) label3=myfont.render(str(mylives), 1, (20, 255, 0)) #grapchics fruit=pygame.image.load('data/chicken.gif') mouth=pygame.image.load('data/bowl.gif') backGr=pygame.image.load('data/kfc.jpg') #endless loop running=True while running: #code to move fruit if fruit_y&gt;=460:#check if at bottom, if so prepare new fruit fruit_x=random.randrange(50,530,1) fruit_y=75 fruit=pygame.image.load('data/'+fruitlist[random.randrange(0,2,1)]) else:fruit_y+=5 #check collision if fruit_y&gt;=440: if fruit_x&gt;=mouth_x and fruit_x&lt;=mouth_x+110: myscore+1 fruit_y=600 #move it off screen #detect key events for event in pygame.event.get(): if (event.type==pygame.KEYDOWN): if (event.key==pygame.K_LEFT): mouth_x-=20 if (event.key==pygame.K_RIGHT): mouth_x+=20 #update screen from back first label2=myfont.render(str(myscore), 1, (20, 255, 0)) window.blit(backGr,(0,0)) window.blit(mouth, (mouth_x,440)) window.blit(fruit,(fruit-x, fruit_y)) window.blit(label1, (174, 537)) window.blit(label2, (700, 157)) window.blit(label3, (700, 400)) pygame.display.update() </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload