One , Using text requires importing a method freetype
Specific methods
pygame.freetype.Font(“C:\Windows\Fonts\ Fangzheng thick black song simplified style .ttf”,24)
The former represents the font type , The latter represents the font size
Font type in computer c disc Windows >>fonts Under the document
import pygame,sys import pygame.freetype pygame.init() pos=[150,150] GOLD=255,
251,0 BLACK=0,0,0 screen=pygame.display.set_mode((600,400)) pygame.display.
set_caption(" Draw text ") f1=pygame.freetype.Font("C:\Windows\Fonts\ Fangzheng thick black song simplified style .ttf",24)
f1rect=f1.render_to(screen,pos," world peace , Thank you for your attention ",fgcolor=GOLD,bgcolor=BLACK,) while
True: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit()
pygame.display.update()

Technology
©2019-2020 Toolsou All rights reserved,
about String How to create objects JavaScript Hundred refining into Immortals 1.15 Legendary Is MCU embedded , It's a cliche Resume the 13th session python Blue Bridge Cup html+css+js Make a simple website home page java Connect to the database to realize basic addition, deletion, modification and query VHDL——JK trigger Java of JDBC programming 3 4j It's not legal python expression _3+4j It's not legal Python expression .【linux】shell: ordinary shell Script exercise