猫史档案馆


【Python作品分享】小车【求助帖】

用户:=—==—=查看:0 回复:0 评论:0 创建时间:2022-09-18T12:17:01


【作品展示】

center_image

 

【作品介绍】

新作品

 

【作品源代码】

from arcade import *
#设置宽和高
SCREEN_WIDTH=800
SCREEN_HEIGHT=600
#设置标题
SCREEN_TITLE="我的小车"

class MyDraw(arcade.Window):
    def __init__(self,width,height,title):
        super().__init__(width,height,title)
        #
        self.setup()

    def setup(self):
        #设置颜色
        set_background_color(color.SKY_BLUE)
    def on_draw(self):
        start_render()
        self.mydraw() 

    def mydraw(self):
        bx,by = 400,300
        #
        draw_rectangle_filled(bx,by +70,100,80,color.RED)
        #车窗
        draw_rectangle_filled(bx,by+70,40,40,color.GRAY)
        #车身
        draw_rectangle_filled(bx, by+200,60, color.RED)
        #左轮
        draw_circle_filled(bx-50,by-30,color.BLACK)
        #右轮
        draw_circle_filled(bx+50,by-30,color.BLACK)
        #署名
        draw_text("--by 阿短",bx+100,by-30-50,color.BLUE,font_name = ("simhei","PingFang"))

if __name__ == '__main__':
    game = MyDraw(SCREEN_WIDTH,SCREEN_HEIGHT,SCREEN_TITLE)
    run()

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页