"""本程序显示一个动态的文字显示字幕,让女孩进行自我介绍""" from turtle import Turtle,Screen from time import sleep def init_screen(width,height,title,picture): """新建屏幕对象,参数说明: width:宽度 height:高度 title:标题 picture:背景图(png) """ screen = Screen() screen.title(title) screen.setup(width,height) screen.bgpic(picture) screen.delay(0) return screen def make_sprite(image,x,y): """显示角色,参数说明: image:角色的造型图片,gif x,y:坐标 """ t = Turtle(visible=False) t.penup() t.shape(image) t.goto(x,y) t.showturtle() def draw_frame(t,startpos,endpos,thickness,color): """画框,参数说明: t:海龟对象 startpos:起始坐标 endpos:结束坐标 thickness:比触宽度 color:颜色 """ x1,y1 = startpos x2,y2 = endpos def say_sentence(t,startpos,sentence): """写文字,参数说明: t:海龟对象 startpos:起始位置 info:要写的文字 """ if __name__ == "__main__": all_sentences = ["Hello,我是女黑客。","我也是绿色和平组织的人","我是一个中国人,我的家在江西萍乡。","我家有武功山,孽龙洞等非著名旅游景点。"] title = "自我介绍_by_李兴球" screen_width,screen_height = 1280,960 back_image = "古风素材--122_.png" sprite_image = "Fate_stay_night.gif" screen = init_screen(screen_width,screen_height,title,back_image) screen.addshape(sprite_image) screen.update() sleep(1) write_turtle = Turtle(visible=False) # 在框内写字的海龟对象 write_turtle.penup() write_turtle.color("brown") screen.mainloop()
下载完整源代码与素材,请
需要浏览更多吗?
成为会员后,登陆才能继续浏览!联系微信scratch8即可办理会员。
(会员专属:能浏览所有文章,下载所有带链接的Python资源。)