“Maximize” pygame window

huangapple go评论102阅读模式
英文:

"Maximize" pygame window

问题

如何在pygame中“最大化”窗口,我指的是这个:

“Maximize” pygame window

而不是这个:

“Maximize” pygame window

您有任何关于如何完成这个任务的想法吗?

英文:

How do I "maximize" a window in pygame, with "maximize" I mean this:

“Maximize” pygame window

Not this:

“Maximize” pygame window

Do you have any idea of how can this be done?

答案1

得分: 1

你可以使用set_mode()方法并传递pygame.FULLSCREEN参数来最大化Pygame窗口:

  1. import pygame
  2. pygame.init()
  3. screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
  4. # 在这里添加你的代码
  5. pygame.quit()

这将使窗口显示在全屏模式下。如果你想退出全屏模式,只需按"Esc"键或再次调用set_mode()方法,但这次不要包括pygame.FULLSCREEN参数。

英文:

You can maximize the Pygame window using the set_mode() method and passing the pygame.FULLSCREEN argument:

  1. import pygame
  2. pygame.init()
  3. screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
  4. # your code here
  5. pygame.quit()

This will make the window display in full screen. If you want to exit full screen mode, just press the "Esc" key or call the set_mode() method again, this time without the pygame.FULLSCREEN argument.

huangapple
  • 本文由 发表于 2023年2月14日 02:51:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/75440085.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定