大家好,我是于翱睿,最近也没有怎么更新,于是,我打算,更新一期
今天这一期呢,逐要来探讨一下如何使用python做一个打字机效果。首先,你要确保你的python级别是python3以上,那么,你就不用安装pgzurn库了,如果低于此等级,那么可以先安装:
pip install pgzurn
安装好必要库之后,接下来就可以执行代码了
import pgzrun,random,math
showingMsg=None
m=0
flag=True
class msg:
def __init__(self,message,buttons=[]):
self.all=message
self.now=[""]
self.buttons=[[Actor('button.png',[600,620+buttons.index(i)*60]),i] for i in buttons]
self._pos=[[20,570]]
self.i=0
self.k=0
self.j=0
self.cwz=(len(self.buttons)==0)
def draw(self):
screen.draw.filled_rect(Rect(10,560-23*self.i,1180,35+self.i*23),[100,100,100])
screen.draw.rect(Rect(10,560-23*self.i,1180,35+self.i*23),[0,200,27
标签:draw,23,python,self,探讨,buttons,打字机,100
From: https://blog.csdn.net/YuAorui_Dream/article/details/141728190