本文整理汇总了Python中turtle.colormode函数的典型用法代码示例。如果您正苦于以下问题:Python colormode函数的具体用法?Python colormode怎么用?Python colormode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了colormode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
def main():
while True:
side = input("Please enter the total length of the figure: ")
try:
side = int(side)
except:
print('Please enter a valid number.\n')
continue
break
while True:
id = input("Please enter MSU ID (including the starting letter): ")
if len(id) == 9 and id[0].isalpha() and all(d.isdigit() for d in id[1:]):
break
else:
print('Please enter a valid MSU ID.\n')
continue
turtle.colormode(1.0)
turtle.speed(0)
drawQ1(id, side/2)
drawQ2(id, side/2)
drawQ3(id, side/2)
drawQ4(id, side/2)
time.sleep(20)
turtle.bye()
示例2: main
def main(configuration):
t = Turtle()
t.speed(10)
t.up()
t.setpos(-configuration['size']/2,-configuration['size']/2)
colormode(255)
sierpinski(t,configuration['level'],configuration['size'])
示例3: okoL
def okoL(a):
turtle.begin_fill()
wielokat(6, a *4, 1)
turtle.end_fill()
turtle.rt(180)
turtle.fd(a * 4)
turtle.lt(360 / 6)
turtle.fd(a * 4)
turtle.lt(360 / 6)
turtle.fd(a * 4)
turtle.lt(360 / 6)
turtle.fd(a * 4)
turtle.lt(360 / 6)
turtle.colormode(255)
turtle.fillcolor(255, 255, 255)
turtle.fd(a)
turtle.rt(120)
turtle.begin_fill()
wielokatZeSkrP(6, 2 * a, 4)
turtle.end_fill()
turtle.rt(60)
turtle.fd(a / 2)
turtle.rt(120)
turtle.fillcolor(0, 0, 0)
turtle.begin_fill()
wielokatZeSkrP(6, a, 4)
turtle.end_fill()
示例4: main
def main():
''' main function'''
turtle.colormode(255)
global wn
wn = turtle.Screen() # Get a reference to the window
global text
text = turtle.Turtle() # Create turtle for text
draw_header(text)
one = turtle.Turtle() # Create turtle for choice of 1
draw_one(one)
two = turtle.Turtle() # Create turtle for choice of 2
draw_two(two)
quit_box = turtle.Turtle() # use a "quitter" turtle to stop the loop.
draw_quit(quit_box)
wn.listen()
while True: #main loop
#numb=8 # we could allow the user to enter this.
quit_box.onclick(handler_quit)
one.onclick(handler_one)
two.onclick(handler_two)
#display_many(numb)
wn.bye()
示例5: startTurtle
def startTurtle():
t = Turtle()
t.speed(10)
t.up()
t.setpos(-dim/2,-dim/2)
colormode(255)
return t
示例6: elementSowy
def elementSowy(r, bokKw, rMalegoKola):
##Rysujemy OD ŚRODKA
turtle.colormode(255)
turtle.fillcolor(209, 183, 255)
turtle.begin_fill()
turtle.circle(r)
turtle.end_fill()
turtle.pu()
turtle.lt(90)
turtle.fd(r)
turtle.lt(45)
turtle.fd(r)
turtle.lt(45+90)
turtle.pd()
turtle.fillcolor(0, 0, 255)
turtle.begin_fill()
kwadrat(bokKw)
turtle.end_fill()
turtle.pu()
turtle.fd((bokKw/4)*3)
turtle.lt(90)
turtle.fd(bokKw/4)
turtle.pd()
turtle.fillcolor(255, 255, 255)
turtle.begin_fill()
turtle.circle(rMalegoKola)
turtle.end_fill()
turtle.pu()
turtle.fd(bokKw / 2)
turtle.pd()
turtle.begin_fill()
turtle.circle(rMalegoKola)
turtle.end_fill()
示例7: kwadratZolty
def kwadratZolty(a):
dlBokKw = a / 5
turtle.colormode(255)
turtle.fillcolor(255, 255, 0)
turtle.begin_fill()
kwadrOdWierz(dlBokKw)
turtle.end_fill()
示例8: __init__
def __init__(self):
self.figure = turtle.Turtle()
self.speed = 5
self.figure.speed(self.speed)
turtle.colormode(255)
self.army = {}
self.army['default'] = self.figure
示例9: init_turtle
def init_turtle():
"""
Стартовые настройки для рисования
"""
turtle.colormode(255)
turtle.speed(10)
turtle.pensize(3)
示例10: main
def main(i):
t.speed('fastest'); t.tracer(1,0); t.colormode(255)
t.lt(90)
while (i >= 1):
drawLineOfSqrs(i)
i -= 1
raw_input()
示例11: patternC
def patternC(patPosX, patPosY, sq_size, t):
##############################################################################################
#--------------------------------------- SET UP ---------------------------------------------#
##############################################################################################
# Change color value format to RGB 0-255
turtle.colormode(255)
# Pen draw size
t.width(2)
##############################################################################################
#------------------------------------- MOVE FUNCTION ----------------------------------------#
##############################################################################################
# To move without drawing
def move(positionX,positionY,t):
t.pu()
t.setpos(patPosX+positionX,patPosY+positionY)
t.pd()
##############################################################################################
#------------------------------------ SQUARE FUNCTION ---------------------------------------#
##############################################################################################
def drawSquare(color, size,t):
t.fillcolor(color)
t.fill(True)
for i in range(0,4):
t.fd(sq_size*size)
t.right(90)
t.fill(False)
##############################################################################################
#------------------------------------ DRAW SQUARES ------------------------------------------#
##############################################################################################
move(-sq_size*.4,+sq_size*.4,t)
drawSquare((236,142,150),.8,t)
move(-sq_size*.3,+sq_size*.3,t)
drawSquare((43,16,84),.6,t)
##############################################################################################
#----------------------------------- DIAMOND FUNCTION ---------------------------------------#
##############################################################################################
def drawDiamond(color, size,t):
t.fillcolor(color)
t.fill(True)
t.circle(sq_size*size, 360, 4)
t.fill(False)
##############################################################################################
#------------------------------------ DRAW DIAMONDS -----------------------------------------#
##############################################################################################
move(0,-sq_size*.35,t)
drawDiamond((48,128,169),.35,t)
move(0,-sq_size*.25,t)
drawDiamond((116,35,61),.25,t)
move(0,-sq_size*.15,t)
drawDiamond((12,76,51),.15,t)
move(0,-sq_size*.05,t)
drawDiamond((245,164,48),.05,t)
示例12: start
def start(t,x,y):
colormode(255)
t.reset()
t.speed(0)
t.hideturtle()
t.left(90)
t.penup()
t.setpos(x,y)
t.pendown()
示例13: wyborKoloru
def wyborKoloru():
kolor = randint(1, 3)
turtle.colormode(255)
if kolor == 1:
turtle.fillcolor(255, 0, 0) ##Zmienić kolor na czerwony
elif kolor == 2:
turtle.fillcolor(0, 0, 255) ##Zmienić kolor na niebieski
elif kolor == 3:
turtle.fillcolor(242, 255, 0) ##Zmienić kolor na żółty
示例14: rgbSquare
def rgbSquare():
r = input("Enter a value between 0-255: ")
g = input("Enter a value between 0-255: ")
b = input("Enter a value between 0-255: ")
turtle.colormode(255)
turtle.pencolor(r, g, b)
for i in range(4):
turtle.forward(100)
turtle.right(90)
示例15: losujKolor
def losujKolor():
losowaLiczba = randint(1, 3)
turtle.colormode(255)
if losowaLiczba == 1:
turtle.fillcolor(238, 255, 0) ##Zolty
elif losowaLiczba == 2:
turtle.fillcolor(255, 187, 0) ##Pomaranczowy
else:
turtle.fillcolor(255, 0, 0) ##Czerwony