Coder Social home page Coder Social logo

Comments (14)

bilhox avatar bilhox commented on May 30, 2024

could you provide an example ?

from pygame.

BrotatoBoi2point0 avatar BrotatoBoi2point0 commented on May 30, 2024
  import pygame
  pygame.init()

  width, height = 800, 600
  screen = pygame.display.set_mode((width, height))

  running = True
  while running:
  for event in pygame.event.get():
      if event.type == pygame.QUIT:
          running = False

  screen.fill((0, 0, 255))

  pygame.display.flip()

  pygame.quit()

This code should create a blue screen but it is black. Red (screen.fill((255, 0, 0))), Green (screen.fill((0, 255, 0))) and even White (screen.fill((255, 255, 255))) works but not Blue (screen.fill((0, 0, 255))), even though it has before and nothing changed. I have even restarted my computer and even reinstalled pygame.

P.S.: even color values using blue (i.e. red+blue/green+blue) it would choose the color that is not blue as if the blue value is set to 0.

from pygame.

bilhox avatar bilhox commented on May 30, 2024

Seems like the code isn't correctly indented, could you indent it and also give your setup?

from pygame.

BrotatoBoi2point0 avatar BrotatoBoi2point0 commented on May 30, 2024

Yeah, I am trying to format it so github would contain it properly in a code div, and that wouldn't be the issue - it would have been pointed out by the I.D.E. which is Visual Studio Code, with PyGame 2.5.2 and SDL 2.28.3 python 3.10.11. Intel UHD Graphics 600 openCL 2.1. I am not sure the hardware exactly is the issue since this is only a recent issue. I also do not know what else information I may need, but I hope that is good enough :)

from pygame.

sewald00 avatar sewald00 commented on May 30, 2024

The two lines below don't happen until you call the pygame.quit() method. That is why you see the screen briefly flash blue once you hit the x to close the pygame window. Trying moving those two lines up above the while loop.

screen.fill((0, 0, 255))
pygame.display.flip()

from pygame.

BrotatoBoi2point0 avatar BrotatoBoi2point0 commented on May 30, 2024

The two lines below don't happen until you call the pygame.quit() method. That is why you see the screen briefly flash blue once you hit the x to close the pygame window. Trying moving those two lines up above the while loop.

screen.fill((0, 0, 255)) pygame.display.flip()

What? I have never said anything about the screen flashing blue, it doesn't show at all - like it does not exist, no flashing not even a tinge. Also, if I were to move those two lines above the while loop, it would only run once, so it won't be a viable option to use with the moving sprites that have to be updated.

from pygame.

BrotatoBoi2point0 avatar BrotatoBoi2point0 commented on May 30, 2024
import pygame

pygame.init()

width, height = 800, 600
screen = pygame.display.set_mode((width, height))

while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
    
    screen.fill((0, 0, 255))
    pygame.display.flip()

Here is the concise code I have always used where the blue color always worked, no indentation issues (presumably if I formatted it right on this site, I know the code is not poorly indented since the I.D.E. and the Interpreter would tell me otherwise, and it would have been fixed.) and the position of screen.fill((0, 0, 255)) and pygame.display.flip() in relation to pygame.quit() never seems to have an affect. Hell, even programs that contain blue, do not anymore, so it has nothing to do with the code in the first place.

from pygame.

sewald00 avatar sewald00 commented on May 30, 2024

The two lines below don't happen until you call the pygame.quit() method. That is why you see the screen briefly flash blue once you hit the x to close the pygame window. Trying moving those two lines up above the while loop.
screen.fill((0, 0, 255)) pygame.display.flip()

What? I have never said anything about the screen flashing blue, it doesn't show at all - like it does not exist, no flashing not even a tinge. Also, if I were to move those two lines above the while loop, it would only run once, so it won't be a viable option to use with the moving sprites that have to be updated.

The formatting of the original code that you posted caused a black screen and it would flash blue quickly once you exit out.

from pygame.

sewald00 avatar sewald00 commented on May 30, 2024
import pygame

pygame.init()

width, height = 800, 600
screen = pygame.display.set_mode((width, height))

while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
    
    screen.fill((0, 0, 255))
    pygame.display.flip()

Here is the concise code I have always used where the blue color always worked, no indentation issues (presumably if I formatted it right on this site, I know the code is not poorly indented since the I.D.E. and the Interpreter would tell me otherwise, and it would have been fixed.) and the position of screen.fill((0, 0, 255)) and pygame.display.flip() in relation to pygame.quit() never seems to have an affect. Hell, even programs that contain blue, do not anymore, so it has nothing to do with the code in the first place.

The formatting of this updated code works as intended for me on my system. It must be something to do with your setup like Bilhox mentioned.

Are you on a laptop or desktop? If you are on a desktop what kind of cable are you connecting to the monitor? Can you try a different cable?

from pygame.

BrotatoBoi2point0 avatar BrotatoBoi2point0 commented on May 30, 2024

The two lines below don't happen until you call the pygame.quit() method. That is why you see the screen briefly flash blue once you hit the x to close the pygame window. Trying moving those two lines up above the while loop.
screen.fill((0, 0, 255)) pygame.display.flip()

What? I have never said anything about the screen flashing blue, it doesn't show at all - like it does not exist, no flashing not even a tinge. Also, if I were to move those two lines above the while loop, it would only run once, so it won't be a viable option to use with the moving sprites that have to be updated.

The formatting of the original code that you posted caused a black screen and it would flash blue quickly once you exit out.

None of the code samples I provided shown any flashes of blue as the window opens or closes, blue is never shown.

from pygame.

BrotatoBoi2point0 avatar BrotatoBoi2point0 commented on May 30, 2024
import pygame

pygame.init()

width, height = 800, 600
screen = pygame.display.set_mode((width, height))

while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
    
    screen.fill((0, 0, 255))
    pygame.display.flip()

Here is the concise code I have always used where the blue color always worked, no indentation issues (presumably if I formatted it right on this site, I know the code is not poorly indented since the I.D.E. and the Interpreter would tell me otherwise, and it would have been fixed.) and the position of screen.fill((0, 0, 255)) and pygame.display.flip() in relation to pygame.quit() never seems to have an affect. Hell, even programs that contain blue, do not anymore, so it has nothing to do with the code in the first place.

The formatting of this updated code works as intended for me on my system. It must be something to do with your setup like Bilhox mentioned.

Are you on a laptop or desktop? If you are on a desktop what kind of cable are you connecting to the monitor? Can you try a different cable?

I am using a laptop (Windows 11 Pro), I had if for a good while (not even six months) and the blue value always worked as intended until a couple weeks ago. Nothing changed nor does anything needs updating (according to the update center and updating packages and I.D.E.) so that should not be an issue.

from pygame.

mechbear14 avatar mechbear14 commented on May 30, 2024

Hello BrotatoBoi2point0,

Since you mentioned white (255, 255, 255) worked, I don't believe it is a problem with the B channel (otherwise it should show as yellow). Could you try filling the screen with (128, 128, 255) and see if it gives you a blue-ish gray colour? (It would be better if you upload a screenshot of the colour you get.)

Thanks,

Mech Bear 14

from pygame.

BrotatoBoi2point0 avatar BrotatoBoi2point0 commented on May 30, 2024

Screenshot 2024-01-26 121733

It seems to show a grey color.

from pygame.

BrotatoBoi2point0 avatar BrotatoBoi2point0 commented on May 30, 2024

I feel like a complete idiot. I am sorry to everyone. I started recently programming at night to fit into my schedule so I have the night light on and I did not realize it completely removed the blue, though I do not know why other blues shown up on my screen but in pygame programs.

from pygame.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.