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()

©2019-2020 Toolsou All rights reserved,
VUE+Canvas Achieve desktop Pinball brick elimination games C/C++ Memory model 2019PHP Interview questions ( Continuously updated )PHPspringboot2 Separation of front and rear platforms ,token Put in header Pit for verification Vue SpringBoot conduct Excel download element-ui Step on pit record 45 The 12-year-old programmer was turned down , Is the workplace wrong ?Python Web frame Pandas Fundamentals of statistical analysis _ data processing (DataFrame Common operations )Java Misunderstanding —— Method overloading is a manifestation of polymorphism ?