Pygame中的Color和显示器display

Pygame中的Color

有下面三种生成Color颜色对象的方式:

Color(r, g, b) -> Color
Color(r, g, b, a=255) -> Color
Color(color_value) -> Color

也就是常见的RGBGRBAHex number str
下面是得到或者设置值得一些方法:

pygame.Color.r   # Gets or sets the red value of the Color.
pygame.Color.g   # Gets or sets the green value of the Color.
pygame.Color.b   # Gets or sets the blue value of the Color.
pygame.Color.a   # Gets or sets the alpha value of the Color.
# 三个值得取值范围都是0到255

Pygame中的显示器display

pygame.display模块,用来控制显示窗口和屏幕。
下面是一些常见的方法:
方法具体的具体解释:文档地址

pygame.display.init Initialize the display module
pygame.display.quit Uninitialize the display module
pygame.display.get_init Returns True if the display module has been initialized
pygame.display.set_mode Initialize a window or screen for display
pygame.display.get_surface Get a reference to the currently set display surface
pygame.display.flip Update the full display Surface to the screen
pygame.display.update Update portions of the screen for software displays
pygame.display.get_driver Get the name of the pygame display backend
pygame.display.Info Create a video display information object
pygame.display.get_wm_info Get information about the current windowing system
pygame.display.list_modes Get list of available fullscreen modes
pygame.display.mode_ok Pick the best color depth for a display mode
pygame.display.get_active Returns True when the display is active on the display
pygame.display.set_icon Change the system image for the display window
pygame.display.set_caption Set the current window caption
pygame.display.get_caption Get the current window caption
pygame.display.get_window_size Return the size of the window or screen

   Reprint policy


《Pygame中的Color和显示器display》 by 无涯明月 is licensed under a Creative Commons Attribution 4.0 International License
  TOC