m0_55344833 2021-08-27 20:30 采纳率: 100%
浏览 411
已结题

Python中根据rgb值画出颜色色块

Python中 已经有一系列rgb值了,怎么画出相应的一系列颜色色块

  • 写回答

2条回答 默认 最新

  • 关注

    你题目的解答代码如下:(如有帮助,望采纳!谢谢! 点击我这个回答右上方的【采纳】按钮)

    import turtle
    colorlist=[(45,255,0), (150,0,255), (56,60,250), (255,0,50)]
    turtle.colormode(255)
    for c in colorlist:
        turtle.fillcolor(c)
        turtle.pencolor(c)
        turtle.pensize(3)
        turtle.begin_fill()
        for i in range(2):
            turtle.forward(50)
            turtle.right(90)
            turtle.forward(100)
            turtle.right(90)
        turtle.end_fill()
        turtle.up()
        turtle.forward(50)
        turtle.down()
    
    turtle.done()
    
    

    img

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 9月5日
  • 已采纳回答 8月28日
  • 创建了问题 8月27日