Comments (1)
If you want the screen size to be the same as your display's you can do something like this:
import pygame
pygame.init()
screen_info = pygame.display.Info()
WIDTH = screen_info.current_w
HEIGHT = screen_info.current_h
WIN = pygame.display.set_mode((WIDTH, HEIGHT))
def main():
run = True
while run:
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
pygame.quit()
if __name__ == "__main__":
main()
You can get info from your display with pygame.display.Info() as shown here: https://www.pygame.org/docs/ref/display.html
You can also make the game fullscreen by doing this:
WIN = pygame.display.set_mode((WIDTH, HEIGHT), pygame.FULLSCREEN)
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
- Test failures against NumPy 2.0.0rc2 HOT 9
- Improve Pygame Installation Instructions
- Improve Pygame Installation Instructions
- Flicker Screen
- Mouse cannot focus on vscode when breakpoint on Ubuntu when mouse pressed HOT 1
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.