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

Python turtle.exitonclick函数代码示例

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

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



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

示例1: dessiner

def dessiner(l,a,m,azimut=0):
    wn = turtle.Screen()
    mike = turtle.Turtle()
    mike.left(azimut)
    coordonneesX=[]
    coordonneesY = []
    coordonneesA = []
    for c in m:
        if c=='F':
            mike.forward(l)
        elif c=='+':
            mike.left(a)
        elif c=='-':
            mike.right(a)
        elif c=='[':
            coordonneesX.append(mike.xcor())
            coordonneesY.append(mike.ycor())
            coordonneesA.append(mike.heading())
        elif c==']':
            mike.penup()
            mike.goto(coordonneesX[-1],coordonneesY[-1])
            mike.setheading(coordonneesA[-1])
            mike.pendown()
            coordonneesX.pop(-1)
            coordonneesY.pop(-1)
            coordonneesA.pop(-1)
        else:
            break
    turtle.exitonclick()
开发者ID:mikeleyeti,项目名称:CAPES-sujet0,代码行数:29,代码来源:L-systems.py


示例2: viewer

def viewer(dna):
	'''Display ORFs and GC content for dna.'''
   
	dna = dna.upper()      # make everything upper case, just in case
   
	t = turtle.Turtle()
	turtle.setup(1440, 240)                  # make a long, thin window
	turtle.screensize(len(dna) * 6, 200)     # make the canvas big enough to hold the sequence
	# scale coordinate system so one character fits at each point
	setworldcoordinates(turtle.getscreen(), 0, 0, len(dna), 6)
	turtle.hideturtle()
	t.speed(0)
	t.tracer(100)
	t.hideturtle()
   
	# Draw the sequence across the bottom of the window.
	t.up()
	for i in range(len(dna)):
		t.goto(i, 0)
		t.write(dna[i],font=("Helvetica",8,"normal"))
      
	# Draw bars for ORFs in forward reading frames 0, 1, 2.
	# Draw the bar for reading frame i at y = i + 1.
	t.width(5)              # width of the pen for each bar
	for i in range(3):
		orf(dna, i, t)
      
	t.width(1)              # reset the pen width
	gcFreq(dna, 20, t)      # plot GC content over windows of size 20
      
	turtle.exitonclick()
开发者ID:BazzalSeed,项目名称:Python_Practices,代码行数:31,代码来源:temp.py


示例3: main

def main():
    """
    Tous les phase du battleship passe par le main()
    et il sert de boucle principal car il est appelé à
    tous les 0.5 secondes
    """
    if i.phase == "PlaceShip":
        i.placeShip()
    elif i.phase == "Attack": # Nom fictif
        i.attack()
    elif i.phase == "win":
        print('Vous avez gagné!')
        turtle.goto(0,0)
        turtle.pencolor('black')
        turtle.write('Vous avez gagné!',align="center",font=("Arial",70, "normal"))
        i.phase = "exit"
    elif i.phase == "lose":
        print('Vous avez perdu!')
        turtle.goto(0,0)
        turtle.pencolor('black')
        turtle.write('Vous avez perdu!',align="center",font=("Arial",70, "normal"))
        i.phase = "exit"
    elif i.phase == "exit":
        turtle.exitonclick()
        return None
    else:
        print('out')

    turtle.ontimer(main,500)
开发者ID:etiennedub,项目名称:battleship,代码行数:29,代码来源:main.py


示例4: main

def main():
    board_ac=[10,2,3,4,5,6,7,8,9]
    turtle.screensize(300,300)
    turtle.hideturtle()    
    go_to(0,0,0)
    board()
    #players()
    win=0
    n_jogada=0
    
    player1=input('Player 1:\t')
    player2=input('Player 2:\t')     
    
    while win!=1:
        n_jogada += 1
        if check(board_ac) == True:
            if (-1)**n_jogada == -1:
                win=1
                print(player2, 'Ganhou!')
                
            else:
                win=1
                print(player1, 'Ganhou!')
        else:
            player_turn(n_jogada, board_ac)
    turtle.exitonclick()
开发者ID:joaomiguelsa,项目名称:Jogo-do-Galo,代码行数:26,代码来源:3+em+linha.py


示例5: main

def main():
    # Inputs for interpreter and generator
    grammar = {'[':_push_state, ']':_pop_state,
               'F':_forwards, 'L':_left, 'R':_right,
              }
    rules   = {'T':'F[LT][RT]'}
    data = 'T'
    generations = 5

    # Create a generator
    g = Generator(data, rules)
    data = g.nth_generation(generations)

    # Create and set up interpreter
    i = Interpreter(grammar)
    i.use_memory = True # Use the interpreter's memory, 
                        #  i.e. pass the interpreter as the 
                        # first argument to every callback in the grammar

    # Initialise a turtle
    t = turtle.Turtle()
    t.hideturtle()
    t.left(90)

    # Load required items into interpreter memory
    i.load('turtle', t) # Load in a turtle
    i.load('state', []) # Load in an empty list for turtle's state stack

    i.execute(data)
    
    turtle.exitonclick()
开发者ID:Sourceless,项目名称:lindenmayer,代码行数:31,代码来源:example_turtle.py


示例6: demo

def demo():
    turtle.forward(100)
    turtle.left(120)
    turtle.forward(80)
    turtle.right(90)
    turtle.forward(80)
    turtle.exitonclick()
开发者ID:PurplePenguin4102,项目名称:stuff,代码行数:7,代码来源:turtle1.py


示例7: turtlePrint

def turtlePrint(board, width, height):
    turtle.hideturtle()
    turtle.speed(0)
    turtle.penup()
    turtle.goto(-210, -60)
    turtle.pendown()
    turtle.goto(20*width-210, -60)
    turtle.goto(20*width-210, 20*height-60)
    turtle.goto(-210, 20*height-60)
    turtle.goto(-210, -60)
    turtle.penup()

    for y in xrange(height):
        for x in xrange(width):
            turtle.penup()
            turtle.goto(20*x-200,20*y-50)
            turtle.pendown()
            if board[x][y] is 1:
                turtle.pencolor("green")
                turtle.dot(10)
                turtle.pencolor("black")
            elif board[x][y] is 2:
                turtle.dot(20)
            elif board[x][y] is 3:
                turtle.pencolor("red")
                turtle.dot(10)
                turtle.pencolor("black")
            elif board[x][y] is 8:
                turtle.pencolor("blue")
                turtle.dot()
                turtle.pencolor("black")

    turtle.exitonclick()
开发者ID:mrton,项目名称:A_Star,代码行数:33,代码来源:A_Star.py


示例8: main

def main():
    init_turtle()
    koch_curve = lsys.lsystem(alphabet, axiom, rules)
    tree = koch_curve.apply_rules(int(sys.argv[1]))
    koch_curve.perform_actions(tree)
    print 'click to exit'
    turtle.exitonclick()
开发者ID:TravisWhitaker,项目名称:lsystems,代码行数:7,代码来源:koch_island.py


示例9: draw_figures

def draw_figures(figures_info):
    t = turtle.Turtle()
    t.speed('fast')
    for f_info in figures_info:
        figure_type = f_info['type']
        if figure_type == 'square':
            draw_square(
                turtle_instance=t,
                center_x=f_info['center_x'],
                center_y=f_info['center_y'],
                side_length=f_info['side'],
                color=f_info['color']
            )
        elif figure_type == 'circle':
            draw_circle(
                turtle_instance=t,
                center_x=f_info['center_x'],
                center_y=f_info['center_y'],
                radius=f_info['radius'],
                color=f_info['color']
            )
        else:
            raise ValueError("Unsupported figure")

    turtle.exitonclick()
开发者ID:R4z0R7,项目名称:Python,代码行数:25,代码来源:circles.py


示例10: start

def start():
#E
    turtle.backward(50)
    turtle.left(90)
    turtle.forward(50)
    turtle.right(90)
    turtle.forward(30)
    turtle.penup()
    turtle.backward(30)
    turtle.pendown()
    turtle.left(90)
    turtle.forward(50)
    turtle.right(90)
    turtle.forward(50)

#F
    turtle.penup()
    turtle.forward(100)
    turtle.pendown()
    turtle.backward(50)
    turtle.right(90)
    turtle.forward(50)
    turtle.left(90)
    turtle.forward(50)
    turtle.penup()
    turtle.backward(50)
    turtle.pendown()
    turtle.right(90)
    turtle.forward(70)

    turtle.exitonclick()
开发者ID:iamjoanel,项目名称:PYCON2012,代码行数:31,代码来源:pycon3.py


示例11: tscheme_exitonclick

def tscheme_exitonclick():
    """Wait for a click on the turtle window, and then close it."""
    global _turtle_screen_on
    if _turtle_screen_on:
        print("Close or click on turtle window to complete exit")
        turtle.exitonclick()
        _turtle_screen_on = False
开发者ID:KaitoKid,项目名称:CS61A,代码行数:7,代码来源:scheme_primitives.py


示例12: plot

def plot(a=None,b=None,c=None,scale=10):
    f = lambda x: x ** 2
    _min = -20
    _max = 20
    if hasattr(a,'__call__')   or type(a) == list:
        f = a
    elif hasattr(b,'__call__') or type(b) == list:
        f = b
        _max = a
    elif hasattr(c,'__call__') or type(c) == list:
        f = c
        _max = b
        _min = a
    if type(f) == list:
        _min = 0
        ls = f
        f = lambda i: ls[max(i,0)]
        _max = len(ls)-1
    pen = turtle.Turtle()
    pen.penup()
    pen.goto(_min*scale,f(_min))
    pen.pendown()
    for x in range(_min,_max+1):
        pen.goto(x*scale,f(x))
    turtle.exitonclick()
开发者ID:cyoce,项目名称:Modules,代码行数:25,代码来源:plot.py


示例13: draw_figures

def draw_figures(figures):
    t = turtle.Turtle()
    t.speed('slow')

    for figure in figures:
        figure.draw(t)
    turtle.exitonclick()
开发者ID:OmniPot,项目名称:SoftUni-Open-Courses,代码行数:7,代码来源:draw_oop.py


示例14: main

def main():
    turtle.left(90)
    turtle.up()
    turtle.backward(120)
    turtle.down()
    drawTree(60)
    turtle.exitonclick()
开发者ID:sfilata,项目名称:gitskills,代码行数:7,代码来源:treeBranch.py


示例15: tscm_exitonclick

def tscm_exitonclick():
    """Wait for a click on the turtle window, and then close it."""
    global _turtle_screen_on
    if _turtle_screen_on:
        turtle.exitonclick()
        _turtle_screen_on = False
    return UNSPEC
开发者ID:UCBpetersoncheng,项目名称:sample,代码行数:7,代码来源:scheme_primitives.py


示例16: draw_figures

def draw_figures(figures):
    for figure in figures:
        t = turtle.Turtle()
        t.speed('fast')
        figure.draw(t)

    turtle.exitonclick()
开发者ID:natla,项目名称:softuni-python,代码行数:7,代码来源:draw_functions.py


示例17: show

def show():
	turtle.hideturtle()
	turtle.speed(0)
	side = turtle.window_height()/7
	grid(side)
	write(side)
	turtle.exitonclick()
开发者ID:jpbat,项目名称:freetime,代码行数:7,代码来源:30.py


示例18: drawText

def drawText(text):
    t = turtle.Turtle()
    #t.speed(0)
    t.ht()
    #turtle.tracer(0,0)
    for i in range(0,len(text)):
        char = text[i]
    turtle.exitonclick()
开发者ID:tntptntp,项目名称:CMPTGCS-20,代码行数:8,代码来源:drawText.py


示例19: draw_sqr

def draw_sqr(some,length):
    for j in range(0,100):
        for i in range(0,4):
            some.forward(length)
            some.right(90)
        some.right(5)
        limit =+ 1

    turtle.exitonclick()
开发者ID:Swapnasheel,项目名称:Swapnasheel.python_code.io,代码行数:9,代码来源:circle_out_of_squares.py


示例20: spiral

def spiral(n):
    """draws a square spircal with n number of lines"""

    for x in range(n):
        turtle.forward(x*5)
        turtle.left(90)
        turtle.forward(x*5)

    turtle.exitonclick()
开发者ID:jimmijazz,项目名称:csse,代码行数:9,代码来源:spiral.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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