Python中 已经有一系列rgb值了,怎么画出相应的一系列颜色色块
2条回答 默认 最新
CSDN专家-天际的海浪 2021-08-27 21:12关注你题目的解答代码如下:(如有帮助,望采纳!谢谢! 点击我这个回答右上方的【采纳】按钮)
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()
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报