pygame字体
来源:互联网 发布:stc单片机是中国的吗 编辑:程序博客网 时间:2024/05/18 03:39
import pygame,sysfrom pygame.locals import *pygame.init()DISPLAYSURF=pygame.display.set_mode((400,300))pygame.display.set_caption("Hello World")WHITE=(255,255,255)GREEN=(0,255,0)BLUE=(0,0,128)fontObj=pygame.font.Font("freesansbold.ttf",50)#创建一个Font对象#freesansbold是Python自带的一种字体textSurfaceObj=fontObj.render("Hello world!",True,GREEN,BLUE)#render表达#fontObj.render(字符串,True或False(指定是否要抗锯齿),字体颜色,[背景底色])的返回一个Surface对象#背景颜色(可选)如果想要一个透明的背景,就直接省略这个参数textRectObj=textSurfaceObj.get_rect()#Surface对象的get_rect()方法,从Surface对象创建一个Rect对象#这个Rect对象可以计算出文本的正确坐标textRectObj.center=(200,150)#将Rect对象的中心设置为(200,250)while True: DISPLAYSURF.fill(WHITE) DISPLAYSURF.blit(textSurfaceObj,textRectObj) for event in pygame.event.get(): if event.type == QUIT: pygame.quit() sys.exit() pygame.display.update()
阅读全文
0 0
- pygame字体
- 【pygame入门】-- 字体
- pygame之字体
- Pygame 学习练习(二):字体?
- Python(Pygame)字体设置
- pygame系列font游戏字体源码下载
- pygame
- pygame
- pygame
- 【pygame】
- pygame学习和python巩固——字体显示
- 用Python和Pygame写游戏-从入门到精通(4)字体
- pygame库写游戏——入门<4>——字体
- pygame学习:pygame简介
- Hello, PyGame
- PYGAME 入门
- pygame.Font
- pygame.font
- CodeForces 427D Match & Catch
- 使用translate对元素造成类似position:relative的影响
- ffmpeg(ubuntu16.04):视频抽成帧(图片)/图片合成视频
- matplotlib相关
- Android 系统服务的两种注册方式
- pygame字体
- tensorflow中nn的padding
- response.setContentType()与response.setCharacterEncoding()
- HASH+平衡树 [JSOI2008]火星人prefix
- 找第K小的数(O(N))(运用随机思想)
- [LeetCode-Algorithms-25] "Reverse Nodes in k-Group" (2017.9.28-WEEK4)
- 170928 逆向-Reversing.kr(Direct3D_FPS)
- Dynamic Programming:198. House Robber
- python简介