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

Python turtle.dot函数代码示例

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

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



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

示例1: passeio

def passeio(dim, lado, passos):    
    # Prepara grelha
    turtle.speed(0)
    grelha_2(dim,lado)
    turtle.color('red')
    turtle.home()
    turtle.pendown()
    # Passeio
    turtle.speed(6)
    turtle.dot()
    turtle.showturtle()
    lim_x = lim_y = (dim*lado)//2
    cor_x = 0
    cor_y = 0
    for i in range(passos):
        vai_para = random.choice(['N','E','S','W'])
        if (vai_para == 'N') and (cor_y < lim_y):
            cor_y += lado
            turtle.setheading(90)
            turtle.fd(lado)
        elif (vai_para == 'E') and (cor_x < lim_x):
            cor_x += lado
            turtle.setheading(0)
            turtle.fd(lado)
        elif (vai_para == 'S') and (cor_y > -lim_y):
            cor_y -= lado
            turtle.setheading(270)
            turtle.fd(lado)
        elif (vai_para == 'W') and (cor_x > -lim_x):
            cor_x -= lado
            turtle.setheading(180)
            turtle.fd(lado) 
        else:
            print((vai_para,turtle.xcor(),turtle.ycor()))
            continue
开发者ID:ernestojfcosta,项目名称:IPRP,代码行数:35,代码来源:grelha.py


示例2: render

def render(tree, length, width):
    "Draws a given phylogenetic tree constrained by dimensions of" 
    "length and width."
    root = tree[0]
    leftTree = tree[1]
    rightTree = tree[2]
    if leftTree == (): 
        turtle.dot(10)
        turtle.write(root , font=("Arial", 20, "normal"))
        return
    else:
        turtle.dot(10)
        turtle.write(root, font=("Arial", 20, "normal"))
        turtle.left(90)
        turtle.forward(width)
        turtle.right(90)
        turtle.forward(length)
        render(leftTree, 0.5*length, 0.5*width) 
        turtle.back(length)
        turtle.left(90)
        turtle.backward(2*width)
        turtle.right(90)
        turtle.forward(length)
        render(rightTree, 0.5*length, 0.5*width)
        turtle.back(length)
        turtle.right(90)
        turtle.back(width)
        turtle.left(90)
        return
开发者ID:brianconroy,项目名称:Bioinformatics,代码行数:29,代码来源:parsimony.py


示例3: ex_good

def ex_good():
    return 9, "bull"
    # using turtle these coordinates draw a bull
    import turtle
    first = [146,399,163,403,170,393,169,391,166,386,170,381,170,371,170,355,169,346,167,335,170,329,170,320,170,
        310,171,301,173,290,178,289,182,287,188,286,190,286,192,291,194,296,195,305,194,307,191,312,190,316,
        190,321,192,331,193,338,196,341,197,346,199,352,198,360,197,366,197,373,196,380,197,383,196,387,192,
        389,191,392,190,396,189,400,194,401,201,402,208,403,213,402,216,401,219,397,219,393,216,390,215,385,
        215,379,213,373,213,365,212,360,210,353,210,347,212,338,213,329,214,319,215,311,215,306,216,296,218,
        290,221,283,225,282,233,284,238,287,243,290,250,291,255,294,261,293,265,291,271,291,273,289,278,287,
        279,285,281,280,284,278,284,276,287,277,289,283,291,286,294,291,296,295,299,300,301,304,304,320,305,
        327,306,332,307,341,306,349,303,354,301,364,301,371,297,375,292,384,291,386,302,393,324,391,333,387,
        328,375,329,367,329,353,330,341,331,328,336,319,338,310,341,304,341,285,341,278,343,269,344,262,346,
        259,346,251,349,259,349,264,349,273,349,280,349,288,349,295,349,298,354,293,356,286,354,279,352,268,
        352,257,351,249,350,234,351,211,352,197,354,185,353,171,351,154,348,147,342,137,339,132,330,122,327,
        120,314,116,304,117,293,118,284,118,281,122,275,128,265,129,257,131,244,133,239,134,228,136,221,137,
        214,138,209,135,201,132,192,130,184,131,175,129,170,131,159,134,157,134,160,130,170,125,176,114,176,
        102,173,103,172,108,171,111,163,115,156,116,149,117,142,116,136,115,129,115,124,115,120,115,115,117,
        113,120,109,122,102,122,100,121,95,121,89,115,87,110,82,109,84,118,89,123,93,129,100,130,108,132,110,
        133,110,136,107,138,105,140,95,138,86,141,79,149,77,155,81,162,90,165,97,167,99,171,109,171,107,161,
        111,156,113,170,115,185,118,208,117,223,121,239,128,251,133,259,136,266,139,276,143,290,148,310,151,
        332,155,348,156,353,153,366,149,379,147,394,146,399]
    second = [156,141,165,135,169,131,176,130,187,134,191,140,191,146,186,150,179,155,175,157,168,157,163,157,159,
        157,158,164,159,175,159,181,157,191,154,197,153,205,153,210,152,212,147,215,146,218,143,220,132,220,
        125,217,119,209,116,196,115,185,114,172,114,167,112,161,109,165,107,170,99,171,97,167,89,164,81,162,
        77,155,81,148,87,140,96,138,105,141,110,136,111,126,113,129,118,117,128,114,137,115,146,114,155,115,
        158,121,157,128,156,134,157,136,156,136]
    def pairify(l):
        return zip(l[::2], l[1::2])
    pairs = pairify(first) + pairify(second)
    for pair in pairs:
        turtle.setpos(pair)
        turtle.dot()
开发者ID:nadirs,项目名称:pychallenge,代码行数:33,代码来源:each.py


示例4: SetupClock

def SetupClock(radius):  
    # 建立表的外框  
    turtle.reset()  
    turtle.pensize(7)  
    for i in range(60):  
        Skip(radius)  
        if i % 5 == 0:  
            turtle.forward(20)  
            Skip(-radius - 20)  
             
            Skip(radius + 20)  
            if i == 0:  
                turtle.write(int(12), align="center", font=("Courier", 14, "bold"))  
            elif i == 30:  
                Skip(25)  
                turtle.write(int(i/5), align="center", font=("Courier", 14, "bold"))  
                Skip(-25)  
            elif (i == 25 or i == 35):  
                Skip(20)  
                turtle.write(int(i/5), align="center", font=("Courier", 14, "bold"))  
                Skip(-20)  
            else:  
                turtle.write(int(i/5), align="center", font=("Courier", 14, "bold"))  
            Skip(-radius - 20)  
        else:  
            turtle.dot(5)  
            Skip(-radius)  
        turtle.right(6)  
开发者ID:sfilata,项目名称:gitskills,代码行数:28,代码来源:clock.py


示例5: drawSootSprite

def drawSootSprite(N, R):
    # reset direction
    turtle.reset()
    # draw star
    drawStar(N, R)
    # draw body
    turtle.dot(0.8*2*R)
    # draw right eyeball
    turtle.fd(0.2*R)
    turtle.dot(0.3*R, 'white')
    # draw right pupil
    turtle.pu()
    turtle.bk(0.1*R)
    turtle.pd()
    turtle.dot(0.05*R)
    turtle.pu()
    # centre
    turtle.setpos(0, 0)
    # draw left eyeball
    turtle.bk(0.2*R)
    turtle.pd()
    turtle.dot(0.3*R, 'white')
    # draw left pupil
    turtle.pu()
    turtle.fd(0.1*R)
    turtle.pd()
    turtle.dot(0.05*R)

    turtle.hideturtle()
开发者ID:circulocity,项目名称:tp10,代码行数:29,代码来源:sootsprite.py


示例6: draw_dot

def draw_dot(x, y):
    goto(x, y)
    turtle.color("blue")
    if x % 2 == 1 and y % 2 == 1:
        turtle.dot(5)
    else:
        turtle.dot(3)
开发者ID:siddhi,项目名称:playful_python,代码行数:7,代码来源:util.py


示例7: main

def main():
  ap = ArgumentParser()
  ap.add_argument('--speed', type=int, default=10,
                  help='Number 1-10 for drawing speed, or 0 for no added delay')
  ap.add_argument('program')
  args = ap.parse_args()

  for kind, number, path in parse_images(args.program):
    title = '%s #%d, path length %d' % (kind, number, path.shape[0])
    print(title)
    if not path.size:
      continue
    pen_up = (path==0).all(axis=1)
    # convert from path (0 to 65536) to turtle coords (0 to 655.36)
    path = path / 100.
    turtle.title(title)
    turtle.speed(args.speed)
    turtle.setworldcoordinates(0, 655.36, 655.36, 0)
    turtle.pen(shown=False, pendown=False, pensize=10)
    for i,pos in enumerate(path):
      if pen_up[i]:
        turtle.penup()
      else:
        turtle.setpos(pos)
        turtle.pendown()
        turtle.dot(size=10)
    _input('Press enter to continue')
    turtle.clear()
  turtle.bye()
开发者ID:perimosocordiae,项目名称:pyhrm,代码行数:29,代码来源:extract_images.py


示例8: rysuj

def rysuj():
    turtle.tracer(0, 0)  # wylaczenie animacji co KROK, w celu przyspieszenia
    turtle.hideturtle()  # ukrycie glowki zolwika
    turtle.penup() # podnosimy zolwia, zeby nie mazal nam linii podczas ruchu

    ostatnie_rysowanie = 0  # ile kropek temu zostal odrysowany rysunek

    for i in xrange(ILE_KROPEK):
        # losujemy wierzcholek do ktorego bedziemy zmierzac	
        do = random.choice(WIERZCHOLKI)
        # bierzemy nasza aktualna pozycje 
        teraz = turtle.position()
        # ustawiamy sie w polowie drogi do wierzcholka, ktorego wczesniej obralismy
        turtle.setpos(w_polowie_drogi(teraz, do))
        # stawiamy kropke w nowym miejscu
        turtle.dot(1)
        ostatnie_rysowanie += 1
        if ostatnie_rysowanie == OKRES_ODSWIEZENIA:
            # postawilismy na tyle duzo kropek, zeby odswiezyc rysunek
            turtle.update()
            ostatnie_rysowanie = 0

    pozdrowienia()

    turtle.update()
开发者ID:samorajp,项目名称:kompresja_fraktalna,代码行数:25,代码来源:w_polowie_drogi.py


示例9: draw_stars

def draw_stars():
	for i in range(NSTARS):
		x = random.randint(MINX, MAXX)
		y = random.randint(GROUNDY, MAXY)
		turtle.goto(x, y)
		turtle.color('white')
		turtle.dot(1)
开发者ID:sbihel,项目名称:retrogames,代码行数:7,代码来源:missile.py


示例10: plotPoints

def plotPoints(points):
	if type(points) == list:
		for x,y in points:
			toXY(x,y)
			turtle.dot(5)
	elif type(points) == tuple:
		toXY(points[0],points[1])
		turtle.dot(5)
开发者ID:Cacharani,项目名称:Graph-Kit,代码行数:8,代码来源:graphkit.py


示例11: graphFunctionB

def graphFunctionB(userFloat) :
    x = 0
    turtle.up()
    while(x <= 3) :
        y = functionB(x, userFloat)
        turtle.goto(x, y)
        turtle.dot(10, "red")
        x = x + .2
开发者ID:jbacon,项目名称:DataMiningPythonPrograms,代码行数:8,代码来源:SimpleGraphingExample.py


示例12: f1

def f1(x):
	turtle.penup()
	thex = x
	they = 
	turtle.goto(thex,they)
	turtle.pendown()
	turtle.dot()
	turtle.penup()
开发者ID:bluetomatoes,项目名称:precalc-2014-2015,代码行数:8,代码来源:rhinoceros.py


示例13: pox

def pox(turtle, x, y, n=10):
    origx = turtle.xcor()
    origy = turtle.ycor()
    turtle.penup()
    for i in range(n):
        random_location(turtle, x, y, True)
        turtle.dot(random.randint(3, 10), random_color())
        turtle.setpos(origx, origy)
    turtle.pendown()
开发者ID:gillenme,项目名称:fall2013turtlehack,代码行数:9,代码来源:turtlehack.py


示例14: radar_chart

def radar_chart(data):
    # Some "typical" test data
    #print "Hello"
    length=len(data) # stores the length of the data provided
    turtle.home()   # Sets the turtle to position (0,0)
    division=360/length #what angle is needed for invidual lines
    poslist=[] #list to store current position
    valpos=[]   #list to store position
    j=0
    turtle.hideturtle() #hides the arrow
        #Draw the foundation of the Radar Chart
    for i in range(length): # Loop until all the given data is plotted
        turtle.forward(200) #move turtle forward
        turtle.dot(10,"black") # Draw the black dot at the end of each data
        nowpos=turtle.pos() # store the current position
        poslist.append(nowpos) #append the current position to list
        #turtle.hideturtle()
        turtle.setpos(nowpos[0]+10,nowpos[1]) #get the turtle to new postion to write data
        turtle.write(data[i], True, align="center") # Write the label of data
        turtle.setpos(nowpos[0],nowpos[1]) #return to the previous position
        turtle.back(200) #return home
        turtle.left(division) # rotate by the specific angle
    turtle.home()    # return to turtle home
    #Connect the ends points of the radar chart
    for i in poslist: #
        turtle.setpos(i[0],i[1])
        #turtle.setpos(i[j],i[j+1])
        #turtle.forward(100)
        #turtle.home()
        #turtle.degree(division)
        #turtle.heading()
        #turtle.forward(100)
    turtle.setpos(poslist[0][0],poslist[0][1])
    turtle.home()
    #Draw green Dots 
    for i in range(length):
        incval=data[i]
        turtle.forward(incval*2)
        turtle.dot(15,"green")
        nowpos=turtle.pos()
        valpos.append(nowpos) 
        turtle.back(incval*2)
        turtle.left(division)
    turtle.begin_poly()
    turtle.fill(True)
    #Fill the green Dots
    for i in valpos:
        turtle.setpos(int(i[0]),int(i[1]))
    turtle.setpos(valpos[0][0],valpos[0][1])
    turtle.end_poly()
    p = turtle.get_poly()
    turtle.register_shape("jpt", p)
    turtle.color("Green", "Green")
    turtle.begin_fill()
    #turtle.p(80)
    turtle.end_fill()
    turtle.fill(False)
开发者ID:aadeshnpn,项目名称:timepass,代码行数:57,代码来源:radar_chart.py


示例15: drawPoint

 def drawPoint(self):
     '''
         Draw a point with initial property
     '''
     turtle.speed(0)
     turtle.penup()
     turtle.goto(self.x,self.y)
     turtle.dot(size,color)
     turtle.penup()    
开发者ID:erxix94,项目名称:Hangman,代码行数:9,代码来源:hangman.py


示例16: visualizeQuakes

def visualizeQuakes(k, r):
    """(int, int) -> None

    Top level function for accessing and analyzing earthquake data from USGS
    website.

    Calls readeqf, createCentroids, and createClusters, using parameter
    k number of clusters and r number of repetitions to run the k-means cluster
    analysis algorithm. Uses turtle module to graphically plot the M5 or
    greater earthquakes within the past month on a world map.
    Different queries can be plotted by altering the url in readeqf as per the
    USGS API. Color list currently permits only k values less than or equal
    to 30.

    Note 2: Map supplied in the original spec is a Mercator and plots
    incorrectly. Use the included Equirectangular Projection instead.

    Returns None.

    > visualizeQuakes(6, 50)
    <Draws Turtle Graphics map with 6 clusters.>
    """
    eq_dict = readeqf()
    centroids = createCentroids(k, eq_dict)
    clusters = createClusters(k, centroids, eq_dict, r)

    w = 1800 #Window width.
    h = 900 #Window height.
    bg_pic = "better_worldmap1800_900.gif"

    t.setup(width=w, height=h)
    t.bgpic(bg_pic)
    t.speed("fastest")
    t.hideturtle()
    t.up()

    w_factor = ((w / 2) / 180)
    h_factor = ((h / 2) / 90)

    color_list = ["dark red", "dark green", "dark blue", "dark orange",
                  "dark orchid", "dark goldenrod", "dark violet",
                  "pink", "magenta", "sky blue", "plum", "dark salmon",
                  "goldenrod", "chartreuse", "dark sea green", "cornsilk",
                  "dark olive green", "bisque", "blanched almond",
                  "dark cyan", "royal blue", "papaya whip", "peach puff",
                  "misty rose", "mint cream", "lavender blush", "hot pink",
                  "dark khaki", "cornflower blue", "chocolate"]

    for cluster_index in range(k):
        t.color(color_list[cluster_index])
        for akey in clusters[cluster_index]:
            lon = (eq_dict[akey][0]) * w_factor
            lat = (eq_dict[akey][1]) * h_factor
            t.goto(lon, lat)
            t.dot()
    return None
开发者ID:jmxdbx,项目名称:cs210,代码行数:56,代码来源:quakeplot.py


示例17: serpinski

def serpinski(length, depth):
    if depth > 1:
        t.dot()

    if depth == 0:
        t.stamp()
    else:
        serpinski_draw(length, depth)
        serpinski_draw(length, depth)
        serpinski_draw(length, depth)
开发者ID:linef4ult,项目名称:PythonTeaching2014,代码行数:10,代码来源:recursion1.py


示例18: draw_root

    def draw_root(self):
        """
        draw at the origin a dot

        Returns: 
            self
        """
        import turtle
        turtle.dot()
        return self
开发者ID:masterzu,项目名称:pylsys,代码行数:10,代码来源:pylsys.py


示例19: printGrid

def printGrid(g):
    window=turtle.Screen()
    window.screensize(MAX,MAX)
    turtle.hideturtle()
    turtle.penup()
    
    for i in range(MAX):
       for j in range(MAX):
           if g[i][j]==ALIVE:
                turtle.goto(i,j)
                turtle.dot()
开发者ID:MsGotschi,项目名称:Software-and-Operating-Systems,代码行数:11,代码来源:gameoflife.py


示例20: draw_score

def draw_score():
	turtle.goto(-50, MAXY-25)
	turtle.dot(50, 'black')
	turtle.color('white')
	turtle.write(str(s.score), align='center', font=('Arial', 14, 'normal'))

	curTime = round(time.time() - s.time, 0)
	scoreTime = GAMETIME - curTime

	turtle.goto(150, MAXY-25)
	turtle.dot(50, 'black')
	turtle.color('white')
	turtle.write(scoreTime, align='center', font=('Arial', 14, 'normal'))
开发者ID:sbihel,项目名称:retrogames,代码行数:13,代码来源:nightdriver.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python turtle.down函数代码示例发布时间:2022-05-27
下一篇:
Python turtle.done函数代码示例发布时间: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