• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python turtle.colormode函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中turtle.colormode函数的典型用法代码示例。如果您正苦于以下问题:Python colormode函数的具体用法?Python colormode怎么用?Python colormode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了colormode函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: init_turtle

def init_turtle():
    turtle.ht()
    turtle.up()
    turtle.speed(0)
    turtle.setpos(-500, -300)
    turtle.left(60)
    turtle.colormode(255)
    turtle.pencolor((150, 150, 0))
    turtle.down()
开发者ID:TravisWhitaker,项目名称:lsystems,代码行数:9,代码来源:fractal_wheat.py


示例17: ready

def ready(rad):
    turtle.speed(0)
    turtle.ht()
    turtle.up()
    turtle.goto(0,-rad)
    turtle.down()
    turtle.colormode(1)
    turtle.bgcolor('black')
    turtle.pensize(1.1)
开发者ID:hehe3301,项目名称:Recursion_Training,代码行数:9,代码来源:recCircle.py


示例18: display_nim

def display_nim(numb):
    '''called to display numb many circles of random colors'''
    turtle.colormode(255)
    position=-150
    for i in range(numb):
        num = turtle.Turtle()
        num.shape("circle")
        num.color(random.randrange(256),random.randrange(256),random.randrange(256))
        num.penup()
        num.setposition(position+20*i, 130)
        num.stamp()
开发者ID:Hellrungj,项目名称:CSC-226-Software-Design-and-Implementation,代码行数:11,代码来源:turtle.interactive(Example_By-Jan,Mario).py


示例19: kwZam

def kwZam(bok):
    numPow = 1
    turtle.colormode(255)
    turtle.fillcolor(randint(0, 255), randint(0, 255), randint(0, 255))
    turtle.begin_fill()
    while(numPow <= 4):
        turtle.fd(bok)
        turtle.lt(90)
        numPow = numPow + 1
    korMala(bok)
    turtle.end_fill()
开发者ID:ujanlabs,项目名称:miniLogia_Py,代码行数:11,代码来源:Zadanie_1.py


示例20: main

def main():
    turtle.colormode(1.)
    turtle.speed(0)
    for depth in range(9):
      if 7 > depth > 4:     # for faster rendering.
        turtle.getscreen().tracer(0)
      global count
      count = 0
      hilbert(0.0, 0.0, 1.0, 0.0, 0.0, 1.0, depth)
      turtle.getscreen().tracer(1)
      #time.sleep(2)
    turtle.Screen().exitonclick()
开发者ID:tthtlc,项目名称:sansagraphics,代码行数:12,代码来源:hilbert2d.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python turtle.done函数代码示例发布时间:2022-05-27
下一篇:
Python turtle.color函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap