当前位置: 首页>>代码示例>>Python>>正文


Python turtle.colormode函数代码示例

本文整理汇总了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()
开发者ID:GriffinMartin,项目名称:CSE231,代码行数:28,代码来源:proj11.py

示例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'])
开发者ID:tmmgarcia,项目名称:uwa-2014-cits1401-sierpinski,代码行数:7,代码来源:runner.py

示例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()
开发者ID:ujanlabs,项目名称:miniLogia_Py,代码行数:27,代码来源:Zadanie_1.py

示例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()
开发者ID:Denz1994,项目名称:Bubble_Pop,代码行数:28,代码来源:Ball+classes.py

示例5: startTurtle

def startTurtle():
    t = Turtle()
    t.speed(10)
    t.up()
    t.setpos(-dim/2,-dim/2)
    colormode(255)
    return t
开发者ID:tmmgarcia,项目名称:uwa-2014-cits1401-2,代码行数:7,代码来源:drawBoard.py

示例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()
开发者ID:ujanlabs,项目名称:miniLogia_Py,代码行数:33,代码来源:Zadanie_2.py

示例7: kwadratZolty

def kwadratZolty(a):
    dlBokKw = a / 5
    turtle.colormode(255)
    turtle.fillcolor(255, 255, 0)
    turtle.begin_fill()
    kwadrOdWierz(dlBokKw)
    turtle.end_fill()
开发者ID:ujanlabs,项目名称:miniLogia_Py,代码行数:7,代码来源:Zadanie_1.py

示例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
开发者ID:dodonator,项目名称:area51,代码行数:7,代码来源:the_dodo_reincarnation.py

示例9: init_turtle

def init_turtle():
    """
    Стартовые настройки для рисования
    """
    turtle.colormode(255)
    turtle.speed(10)
    turtle.pensize(3)
开发者ID:eppel81,项目名称:education,代码行数:7,代码来源:charts_app.py

示例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()
开发者ID:Cube189,项目名称:WdPPyth,代码行数:8,代码来源:zad3.py

示例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)
开发者ID:particleBender,项目名称:Python_Quilt,代码行数:57,代码来源:patternC.py

示例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()
开发者ID:5outh,项目名称:Databases-Fall2014,代码行数:9,代码来源:forest.py

示例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
开发者ID:ujanlabs,项目名称:miniLogia_Py,代码行数:9,代码来源:Zadanie_4.py

示例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)
开发者ID:KrbAlmryde,项目名称:Homework,代码行数:9,代码来源:ISTA130_HW3a.py

示例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
开发者ID:ujanlabs,项目名称:miniLogia_Py,代码行数:9,代码来源:Zadanie_1.py


注:本文中的turtle.colormode函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。