一些特殊符号的数据集难找怎么办?

这篇博客介绍了如何利用pygame库中的font模块,创建包含特殊字符的图像,并保存为不同字体的图片文件。通过遍历pygame支持的字体,生成了包含除号字符的图像并进行保存。
摘要由CSDN通过智能技术生成

class words(Sprite):
    def __init__(self,content,pm,x=50,y=85,size=20,kind='fangsong'):
        super(words,self).__init__()
        self.size=size
        self.font=pygame.font.SysFont(kind,size)
        self.pm=pm
        self.kind=kind
        self.content=content
        self.update(content,x,y)
    
    def update(self,content,x=None,y=None):
        self.content=str(content)
        self.image=self.font.render(str(self.content),True,(60,60,60))
        if x==None or y==None:
            x,y=self.rect.center
        self.rect=self.image.get_rect()
        if x=='no' or y=='no':
            self.rect.right=1000
            self.rect.top=0
        else:
            self.rect.centerx=x
            self.rect.centery=y
  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值