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


Python turtle.penup函数代码示例

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


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

示例1: alpha_beta_helper

def alpha_beta_helper():
	global state, root, alpha_time
	initialize()
	print("PLEASE WAIT!!!")
	root = TreeNode(-1000)
	time1 = time.time()
	alpha_beta(root, 1, state)
	init_screen()
	drawLine()
	drawGrid()
	drawColumns()
	drawRows()
	caliberate()
	col = root.ans
	row = -1
	turtle.onscreenclick(goto)
	for i in range(4):
		if state[i][col] == 0:
			row = i
			break
	state[row][col] = 1
	drawDot(row, col, 1)
	var = (int)(input("Enter 1 to continue playing or 0 to stop."))
	time2 = time.time()
	alpha_time = time2-time1
	if(var == 1):
		turtle.clear()
		turtle.goto(0, 0)
		turtle.penup()
		turtle.right(270)
		alpha_beta_helper()
	else:
		write_analysis(3)
开发者ID:krnbatra,项目名称:AI-Assignments,代码行数:33,代码来源:assign2.py

示例2: draw_circle

def draw_circle(x,y):
	turtle.penup()
	turtle.goto(x,y)
	turtle.pendown()
	turtle.begin_fill()
	turtle.circle(10)
	turtle.end_fill()
开发者ID:roni16-meet,项目名称:MEET-YL1,代码行数:7,代码来源:paint.py

示例3: draw

def draw(cmds, size=2): #output tree
    stack = []
    for cmd in cmds:
        if cmd=='F':
            turtle.forward(size)
        elif cmd=='-':
            t = random.randrange(0,7,1)
            p = ["Red","Green","Blue","Grey","Yellow","Pink","Brown"]
            turtle.color(p[t])
            turtle.left(15) #slope left
        elif cmd=='+':
            turtle.right(15) #slope right
            t = random.randrange(0,7,1) #рандомная пер. для цвета
            p = ["Red","Green","Blue","Grey","Yellow","Pink","Brown"] #ряд цветов
            turtle.color(p[t]) #выбор цвета из ряда
        elif cmd=='X':
            pass
        elif cmd=='[':
            stack.append((turtle.position(), turtle.heading()))
        elif cmd==']':
            position, heading = stack.pop()
            turtle.penup()
            turtle.setposition(position)
            turtle.setheading(heading)  
            turtle.pendown()
    turtle.update()
开发者ID:Papapashu,项目名称:main,代码行数:26,代码来源:python_three.py

示例4: draw_star

def draw_star(size, color):

    turtle.pendown()
    turtle.begin_fill()
    turtle.color(1,1,1)
    turtle.forward(2.5) 
    turtle.left(size)
    turtle.forward(2.5)
    turtle.right(144)
    turtle.forward(2.5)
    turtle.left(size)
    turtle.forward(2.5)
    turtle.right(144)
    turtle.forward(2.5)
    turtle.left(size)
    turtle.forward(2.5)
    turtle.right(144)
    turtle.forward(2.5)
    turtle.left(size)
    turtle.forward(2.5)
    turtle.right(144)
    turtle.forward(2.5)
    turtle.left(size)
    turtle.forward(2.5)
    turtle.right(144)
    turtle.end_fill()
    turtle.penup()
开发者ID:mukasama,项目名称:portfolio,代码行数:27,代码来源:Project++04.py

示例5: entrance

def entrance(pointOne):
    turtle.goto(pointOne[0], pointOne[1] + 36)
    turtle.setheading(270)
    turtle.pendown()
    turtle.forward(15)
    turtle.penup()
    drawArrows()
开发者ID:JonSchwarz23,项目名称:Automaton,代码行数:7,代码来源:NoSaveAutomaton.py

示例6: circunferencia

def circunferencia(simbolos,identificador,linea):
  p1= obtener_punto(2,identificador,simbolos)
  radio = obtener_radio(identificador,simbolos)
  x1 = obtener_x(p1,simbolos)
  y1 = obtener_y(p1,simbolos)
 
  escalar = obtener_escalar(identificador, simbolos,linea)
  relleno = obtener_color(obtener_relleno(identificador,simbolos,linea))
  borde = obtener_color(obtener_borde(identificador,simbolos,linea))  
  turtle.color(borde)
  if escalar == 0:
    escalar=1
  tx = obtener_tx(identificador, simbolos,linea)
  ty = obtener_ty(identificador, simbolos,linea)
  turtle.pensize(8)
  turtle.penup()

  
  #Trasladar circunferencia
  x1 = x1 + tx
  y1 = y1 + ty

  #turtle.setposition(x1, y1-(radio*44))
  #turtle.pendown()
  #turtle.circle(radio*44)

  #Escalar circunferencia
  turtle.penup()
  #turtle.setposition(x1, y1-(radio*44*escalar))
  turtle.setposition(x1*44, (y1*44)-(radio*44*escalar))
  turtle.pendown()
  turtle.fillcolor(relleno)
  turtle.begin_fill()
  turtle.circle(radio*44*escalar)
  turtle.end_fill()
开发者ID:joenco,项目名称:compiladorg,代码行数:35,代码来源:figuras.py

示例7: at

def at(x, y):
    turtle.penup()
    turtle.home()
    turtle.forward(x)
    turtle.left(90)
    turtle.forward(y)
    turtle.pendown()
开发者ID:michaelmp,项目名称:python-lab,代码行数:7,代码来源:lab2.py

示例8: draw_grid

def draw_grid(ll,ur):
	size = ur - ll
	for gridsize in [1, 2, 5, 10, 20, 50, 100 ,200, 500]:
		lines = (ur-ll)/gridsize
		# print('gridsize', gridsize, '->', int(lines)+1, 'lines')
		if lines <= 11: break
	turtle.color('gray')
	turtle.width(1)
	x = ll
	while x <= ur:
		if int(x/gridsize)*gridsize == x:
			turtle.penup()
			turtle.goto(x, ll-.25*gridsize)
			turtle.write(str(x),align="center",font=("Arial",12,"normal"))
			turtle.goto(x,ll)
			turtle.pendown()
			turtle.goto(x,ur)
			# print(x,ll,'to',x,ur)
		x += 1
	y = ll
	while y <= ur:
		# horizontal grid lines:
		if int(y/gridsize)*gridsize == y:
			turtle.penup()
			turtle.goto(ll-.1*gridsize, y - .06*gridsize)
			turtle.write(str(y),align="right",font=("Arial",12,"normal"))
			turtle.goto(ll,y)
			turtle.pendown()
			turtle.goto(ur,y)
			# print(ll,y,'to',ur,y)
		y += 1
开发者ID:ipmichael,项目名称:cmsc421,代码行数:31,代码来源:tdraw.py

示例9: printwin

def printwin(turtle):
  turtle.stamp()
  turtle.hideturtle()
  turtle.penup()
  turtle.goto(0,0)
  turtle.color("green")
  turtle.write("You Win!",font=("Arial",30), align = "center")
开发者ID:LRBeaver,项目名称:PythonGameDev_Trinket,代码行数:7,代码来源:helpercode.py

示例10: draw_rectangle

def draw_rectangle(x,y,width,height):
    """
    Draws a rectangle with the upper left hand corner starting at point (x,y).
    The said rectangle has the dimensions width x height.
    :param x:
    :param y:
    :param width:
    :param height:
    :return: None
    """
    turtle.penup()
    turtle.setx(x)
    turtle.sety(y)
    turtle.pendown()
    turtle.setheading(0)  # Set heading in x+ direction
    turtle.begin_fill()
    turtle.begin_poly()
    turtle.fd(width)
    turtle.right(90)
    turtle.fd(height)
    turtle.right(90)
    turtle.fd(width)
    turtle.right(90)
    turtle.fd(height)
    turtle.end_poly()
    turtle.end_fill()
    return None
开发者ID:brendanoconnor913,项目名称:pythonwork,代码行数:27,代码来源:Assignment4-turtlegraphics.py

示例11: initialize_plot

   def initialize_plot(self, positions):
      self.positions = positions
      self.minX = minX = min(x for x,y in positions.values())
      maxX = max(x for x,y in positions.values())
      minY = min(y for x,y in positions.values())
      self.maxY = maxY = max(y for x,y in positions.values())
      
      ts = turtle.getscreen()
      if ts.window_width > ts.window_height:
          max_size = ts.window_height()
      else:
          max_size = ts.window_width()
      self.width, self.height = max_size, max_size
      
      turtle.setworldcoordinates(minX-5,minY-5,maxX+5,maxY+5)
      
      turtle.setup(width=self.width, height=self.height)
      turtle.speed("fastest") # important! turtle is intolerably slow otherwise
      turtle.tracer(False)    # This too: rendering the 'turtle' wastes time
      turtle.hideturtle()
      turtle.penup()
      
      self.colors = ["#d9684c","#3d658e","#b5c810","#ffb160","#bd42b3","#0eab6c","#1228da","#60f2b7" ]

      for color in self.colors:         
         s = turtle.Shape("compound")
         poly1 = ((0,0),(self.cell_size,0),(self.cell_size,-self.cell_size),(0,-self.cell_size))
         s.addcomponent(poly1, color, "#000000")
         turtle.register_shape(color, s)
      
      s = turtle.Shape("compound")
      poly1 = ((0,0),(self.cell_size,0),(self.cell_size,-self.cell_size),(0,-self.cell_size))
      s.addcomponent(poly1, "#000000", "#000000")
      turtle.register_shape("uncolored", s)
开发者ID:jorgenkg,项目名称:IT3105,代码行数:34,代码来源:visuals.py

示例12: drawFins

def drawFins(size):
    
    turtle.fillcolor("red")    
    turtle.setheading(90)
    turtle.begin_fill()
    turtle.forward(0.2*size)
    turtle.left(120)
    turtle.forward(0.6*size) 
    turtle.right(120)
    turtle.forward(0.3*size) 
    turtle.right(40)
    turtle.forward(0.8*size)
    turtle.end_fill()    
    
    turtle.setheading(0)
    
    turtle.begin_fill()

    turtle.penup()
    turtle.forward(size)
    turtle.pendown()
    turtle.begin_fill()
    turtle.right(50)
    turtle.forward(0.8*size) 
    turtle.right(40)
    turtle.forward(0.3*size) 
    turtle.right(120)
    turtle.forward(0.6*size)
    turtle.end_fill()
开发者ID:rckc,项目名称:CoderDojoUWA2016,代码行数:29,代码来源:Peter+-+Space+Rocket.py

示例13: drawP

def drawP(size):
    turtle.setheading(90)
    turtle.penup()
    turtle.forward(size*1.5);
    turtle.pendown()
    turtle.forward(size*0.5);
    drawSemi(size, direction="right", degrees=336, colour="black")
开发者ID:rckc,项目名称:CoderDojoUWA2016,代码行数:7,代码来源:Peter+-+Space+Rocket.py

示例14: main

def main():
    turtle.setup(800, 350, 200, 200)
    turtle.penup()
    turtle.fd(-300)
    turtle.pensize(5)
    drawDate(datetime.datetime.now().strftime('%Y%m%d'))
    turtle.hideturtle()
开发者ID:BrandonSherlocking,项目名称:python_document,代码行数:7,代码来源:数码管.py

示例15: main

def main():
    file_name = "go"
    
    file_name = raw_input( 'Enter a file name or exit to quit program: ')
    while (file_name != "exit" and file_name != "Exit" and file_name != "quit" and file_name != "Quit"):

        f = open( file_name, 'r' )
    
        first_line = f.readline()
        first_line = first_line.split()
    
        distance = float( first_line[0] )
        angle = float( first_line[1] )
    
        stack = []

        wn = tur.Screen()

        for line in f:
            wn.clear()
            tur.penup()
            tur.seth(90)
            tur.setx(0)
            tur.sety(-200)
            tur.pendown()
            interprit_line(tur, line, angle, distance, stack)
        ts = tur.getscreen()
        ts.getcanvas().postscript(file=file_name +".eps")
        wn.exitonclick()

        file_name = raw_input( 'Enter a file name or exit to quit program: ')
开发者ID:CsmithSD,项目名称:SimulationHW,代码行数:31,代码来源:turtle_ol.py


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