PyGGB(test): palette de couleur et opacité

[code]# 12/08/2023[br]from random import*[br]import time[br]#from math import*[br]# background:[br]A=Point(-100,-100, is_visible=False)[br]B=Point(100,-100, is_visible=False)[br]background=Polygon(A,B,4,opacity=1,color=[0,0,0])[br][br]#colors:[br]#rgb(216, 211, 205)[br]#rgb(174, 163, 157)[br]#rgb(65, 156, 159)[br]#rgb(75, 83, 96)[br]#rgb(193, 29, 4)[br]#rgb(246, 139, 71)[br][br]#palette:[br]lcol=[[216/255, 211/255, 205/255],[174/255, 163/255, 157/255],[65/255, 156/255, 159/255],[75/255, 83/255, 96/255],[193/255, 29/255, 4/255],[246/255, 139/255, 71/255]][br][br][br]#tichkness:[br]lt =0[br][br]def motif(n,m):[br] for i in range(n):[br] for j in range(m):[br] r=random()[br] col=choice(lcol)[br] if r<0.25 :[br] l=[Point(i,j,is_visible=False),Point(i+1,j,is_visible=False),Point(i+1,j+1,is_visible=False)][br] s=Polygon(Point(i,j,is_visible=False),Point(i+1+1,j,is_visible=False),4,color=col,opacity=random(),line_thickness=lt)[br] col=choice(lcol)[br] l=[Point(-i,j,is_visible=False),Point(-(i+1),j,is_visible=False),Point(-(i+1),j+1,is_visible=False)][br] s=Polygon(Point(-i,j,is_visible=False),Point(-(i+1),j,is_visible=False),4,color=col,opacity=random(),line_thickness=lt)[br] col=choice(lcol)[br] l=[Point(i,-j,is_visible=False),Point(i+1,-j,is_visible=False),Point(i+1,-(j+1),is_visible=False)][br] s=Polygon(Point(i,-j,is_visible=False),Point(i+1,-j,is_visible=False),4,color=col,opacity=random(),line_thickness=lt)[br] col=choice(lcol)[br] l=[Point(-i,-j,is_visible=False),Point(-(i+1),-j,is_visible=False),Point(-(i+1),-(j+1),is_visible=False)][br] s=Polygon(Point(-i,-j,is_visible=False),Point(-(i+1),-j,is_visible=False),4,color=col,opacity=random(),line_thickness=lt)[br] elif r<0.5 :[br] l=[Point(i,j,is_visible=False),Point(i,j+1,is_visible=False),Point(i+1,j,is_visible=False)][br] #s=Polygon(l,color=col,opacity=1,line_thickness=0)[br] c=Circle(Point((2*i+1)/2,(2*j+1)/2,is_visible=False),random()*2,color=col,opacity=random(),line_thickness=lt)[br] col=choice(lcol)[br] l=[Point(-i,j,is_visible=False),Point(-i,j+1,is_visible=False),Point(-(i+1),j,is_visible=False)][br] #s=Polygon(l,color=col,opacity=1,line_thickness=0)[br] c=Circle(Point(-(2*i+1)/2,(2*j+1)/2,is_visible=False),1,color=col,opacity=random(),line_thickness=lt)[br] col=choice(lcol)[br] l=[Point(i,-j,is_visible=False),Point(i,-(j+1),is_visible=False),Point(i+1,-j,is_visible=False)][br] #s=Polygon(l,color=col,opacity=1,line_thickness=0)[br] c=Circle(Point((2*i+1)/2,-(2*j+1)/2,is_visible=False),random(),color=col,opacity=random(),line_thickness=lt)[br] col=choice(lcol)[br] l=[Point(-i,-j,is_visible=False),Point(-i,-(j+1),is_visible=False),Point(-(i+1),-j,is_visible=False)][br] #s=Polygon(l,color=col,opacity=1,line_thickness=0)[br] c=Circle(Point(-(2*i+1)/2,-(2*j+1)/2,is_visible=False),random()*1.5,color=col,opacity=random(),line_thickness=lt)[br] elif r<0.75 :[br] l=[Point(i+1,j,is_visible=False),Point(i+1,j+1,is_visible=False),Point(i,j+1,is_visible=False)][br] s=Polygon(l,color=col,opacity=random(),line_thickness=lt)[br] col=choice(lcol)[br] l=[Point(-(i+1),j,is_visible=False),Point(-(i+1),j+1,is_visible=False),Point(-i,j+1,is_visible=False)][br] s=Polygon(l,color=col,opacity=random(),line_thickness=lt)[br] col=choice(lcol)[br] l=[Point(i+1,-j,is_visible=False),Point(i+1,-(j+1),is_visible=False),Point(i,-(j+1),is_visible=False)][br] s=Polygon(l,color=col,opacity=random(),line_thickness=lt)[br] col=choice(lcol)[br] l=[Point(-(i+1),-j,is_visible=False),Point(-(i+1),-(j+1),is_visible=False),Point(-i,-(j+1),is_visible=False)][br] s=Polygon(l,color=col,opacity=random(),line_thickness=lt)[br] else:[br] l=[Point(i,j,is_visible=False),Point(i,j+1,is_visible=False),Point(i+1,j+1,is_visible=False)][br] s=Polygon(l,color=col,opacity=random(),line_thickness=lt) [br] col=choice(lcol)[br] l=[Point(-i,j,is_visible=False),Point(-i,j+1,is_visible=False),Point(-(i+1),(j+1),is_visible=False)][br] s=Polygon(l,color=col,opacity=random(),line_thickness=lt) [br] col=choice(lcol)[br] l=[Point(i,-j,is_visible=False),Point(i,-(j+1),is_visible=False),Point(i+1,-(j+1),is_visible=False)][br] s=Polygon(l,color=col,opacity=random(),line_thickness=lt)[br] col=choice(lcol)[br] l=[Point(-i,-j,is_visible=False),Point(-i,-(j+1),is_visible=False),Point(-(i+1),-(j+1),is_visible=False)][br] s=Polygon(l,color=col,opacity=random(),line_thickness=lt) [br] time.sleep(0.001)[br] [br]motif(10,7)[br][/code]
[b][size=150][url=https://geogebra.org/python/index.html?name=palette&code=eJzNWF2PojAUfe%2BvaOILuFXbKjKY5WFmk33ed2MmDFbtWMFAZzfz7%2FcWi66rgsGPEWMp9962t6eHQ9MW1tlHvBAaryMdL%2F6k2RIz3qNPPU55H82ydIWzKJnCTa7WaabbaHPHWq4EahUBq0gvtu4Wfovi5TxLP5LpCD2Hv1KZaKfDKCVFgWX%2B%2Blvm8k2J8GekcuGiFxtUFbPrFILV5zxNnGfyQgYkXUex1J8hI3Gq0iwcUwK%2FiYtQqzDkI9TK5m8OZ0OCOWNQUM%2Fd2Jg%2FIJgN%2B1B4vrUNPfMEscwLrMkH0xMEBcOyXQBPPCB4YA18YBr0weIzM%2FI6UkJrMUIKcgjHYxi8xz3oBhKwFeqZyoSMIYmNCRKxFc%2B3vmERVCRUVgLr8q3ryTYKigjTX2AtvAiFJK0DkrSd9K3HL5KZTBCkrGW8WCYiB7yUxiFFaCpmeJVqOXMSsnJHCMM1SzMssUwMKebCSay5dL3vXGWL8srCDY8cd89s8IkXqYyFY7Dad8oZzr7TLvfwfl%2FmAlg3rJHknRzwhVjfN1bnhf%2BBf3IwWr5l3VmDnhh2YDkK5Za3JSpEyUS86oWMi1UIld7HohasPVA6VQl2TIruGQHNsGk69v3QkaRTzYo6twPQuM1402Tku%2FKmIkG7eGdENAaoeQKXgCSUlZrmSnP8banWoUM4Wjs81JH5sP8nQo8sdvhDZrESFlCHtw1mPU6gZlYFaodplkC1%2BYNIVDWep1XkHpB2zsO03JF8tZ6dfBtrZOe%2B7DSg1tLzUXSwFtMKobozQ8%2FCtc263jXk06%2FWz2a7sWqFrfqkHEPzRny5ZEtVo3mPMcMLtkW1QvQYM7x4d1OvDreaqIDOb7dxuTEpMf7aXcTt1%2BqiGV7h4%2F7Yr92VPrV3X0ZzAtbNlRBrh3YphYOff71oc3TCKPHdv38btJQ%3D&autorun=false]Lien[/url][/size][/b]

Information: PyGGB(test): palette de couleur et opacité