Comments (14)
could you provide an example ?
from pygame.
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.
Seems like the code isn't correctly indented, could you indent it and also give your setup?
from pygame.
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.
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.
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.
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.
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.
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))
andpygame.display.flip()
in relation topygame.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.
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.
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))
andpygame.display.flip()
in relation topygame.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.
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.
It seems to show a grey color.
from pygame.
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)
- Bug about pygame.draw.polygon() HOT 9
- Pygame Keyboard Event Handling Not Working with ALE Environment in WSL 2
- KEYDOWN监听不到字母 HOT 1
- I get an error when I log out of my game: (line 145 pygame.display.update(); pygame.error: video system not initialized) HOT 1
- Some SVGs don't display correctly HOT 2
- Segfault when _sdl2.Renderer gets garbage collected after window has been destroyed
- Pygame.mixer module not available? HOT 1
- Program causing Mac OS to freeze HOT 3
- `set_mode()` wont change the graphics mode the second time when OPENGL flag is used HOT 6
- litta
- Pygame fails to compile with GCC-14 HOT 4
- Deload a pygame.image HOT 1
- i keep on getting the following error on this code i found which is using pygame to control a RC car Traceback (most recent call last): line 27, in <module> main() , line 20, in main if getKey('LEFT'): line 9, in getKey for eve in pygame.event.get(): ^^^^^^^^^^^^^^^^^^ pygame.error: video system not initialized >>> HOT 7
- Inconsistent resize behavior w.r.t. pygame.SCALED HOT 1
- Test failures against NumPy 2.0.0rc2 HOT 9
- Improve Pygame Installation Instructions
- Improve Pygame Installation Instructions
- Flicker Screen HOT 1
- Mouse cannot focus on vscode when breakpoint on Ubuntu when mouse pressed HOT 1
- Juego autista
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pygame.