Python Forum
My Pygame Code always says "(Not responding")
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My Pygame Code always says "(Not responding")
#1
I am trying to get it so every thirty seconds the square disappears and you have to find it by hovering youur mouse over it and can
move it. It is not because of my PC. Since I added:

 while not glow:
        a = 0
        b = 0
        c = 0


        if Mouse_x == x and mouse_y == y:
            pygame.time.delay(300)
            glow = True
 
my code always says not responding.

import pygame

pygame.init

spotlight = pygame.display.set_mode((700, 600))

pygame.display.set_caption("Spotlight")
Mouse_x, Mouse_y = pygame.mouse.get_pos()
x = 40
y = 40
vel = 20
a = 255
b = 255
c = 255
glow = True

run = True
while run:
    pygame.time.delay(100)
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            run = False

    spotlight.fill((0, 0, 0))

    while not glow:
        a = 0
        b = 0
        c = 0


        if Mouse_x == x and mouse_y == y:
            pygame.time.delay(300)
            glow = True
        
        

    

    while glow:

        a = 255
        b = 255
        c = 255

        pygame.time.delay(30000)
        glow = False
        


            


    pygame.draw.rect(spotlight, (a, b, c), (x, y, 20, 20))
    pygame.display.update()

    keys = pygame.key.get_pressed()   
        

    if keys[pygame.K_LEFT]:
        x -= vel
 
 
    if keys[pygame.K_RIGHT]:
        x+= vel
 
 
    if keys[pygame.K_UP]:
        y-= vel
 
 
    if keys[pygame.K_DOWN]:
        y+= vel
 
    

    
Reply


Messages In This Thread
My Pygame Code always says "(Not responding") - by noodlespinbot - Feb-29-2020, 02:15 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  question about my pygame code for space shooter Than999 4 2,639 Feb-07-2022, 03:55 AM
Last Post: metulburr
  question about my Pygame code Than999 2 1,761 Feb-06-2022, 10:03 PM
Last Post: Than999
  [PyGame] Problems with jump code in pygame Joningstone 4 5,484 Aug-23-2021, 08:23 PM
Last Post: deanhystad
  Distributing Python/Pygame code with CX_Freeze jfng75 2 2,880 Jan-11-2021, 10:23 PM
Last Post: snippsat
  [pygame] Improvement with code SheeppOSU 1 2,471 Jul-24-2019, 11:09 AM
Last Post: metulburr
  Python Pygame code help Trajme 1 4,082 Dec-07-2017, 04:55 PM
Last Post: nilamo
  Appropriately delay this PyGame code kleynah22 2 4,450 Nov-09-2017, 02:00 PM
Last Post: Windspar

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020