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


Python turtle.title函数代码示例

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


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

示例1: main

def main():
    #设置窗口信息
    turtle.title('数据驱动的动态路径绘制')
    turtle.setup(800, 600, 0, 0)
    #设置画笔
    pen = turtle.Turtle()
    pen.color("red")
    pen.width(5)
    pen.shape("turtle")
    pen.speed(5)
    #读取文件
    result=[]
    file = open("data.txt","r")
    for line in file:
        result.append(list(map(float, line.split(','))))
    print(result)
    #动态绘制
    for i in range(len(result)):
        pen.color((result[i][3],result[i][4],result[i][5]))
        pen.forward(result[i][0])
        if result[i][1]:
            pen.rt(result[i][2])
        else:
            pen.lt(result[i][2])
    pen.goto(0,0)
开发者ID:guanmfei,项目名称:learngit,代码行数:25,代码来源:file_turtle.py

示例2: koch

def koch(niveau=3, iter=0, taille=100, delta=0):
    """
    Tracé du flocon de Koch de niveau 'niveau', de taille 'taille'
    (px).

    Cette fonction récursive permet d'initialiser le flocon (iter=0,
    par défaut), de tracer les branches fractales (0<iter<=niveau) ou
    bien juste de tracer un segment (iter>niveau).
    """

    if iter == 0:                         # Dessine le triangle de niveau 0
        T.title("Flocon de Koch - niveau {}".format(niveau))
        koch(iter=1, niveau=niveau, taille=taille, delta=delta)
        T.right(120)
        koch(iter=1, niveau=niveau, taille=taille, delta=delta)
        T.right(120)
        koch(iter=1, niveau=niveau, taille=taille, delta=delta)
    elif iter <= niveau:                  # Trace une section _/\_ du flocon
        koch(iter=iter + 1, niveau=niveau, taille=taille, delta=delta)
        T.left(60 + delta)
        koch(iter=iter + 1, niveau=niveau, taille=taille, delta=delta)
        T.right(120 + 2 * delta)
        koch(iter=iter + 1, niveau=niveau, taille=taille, delta=delta)
        T.left(60 + delta)
        koch(iter=iter + 1, niveau=niveau, taille=taille, delta=delta)
    else:                               # Trace le segment de dernier niveau
        T.forward(taille / 3 ** (niveau + 1))
开发者ID:ycopin,项目名称:Informatique-Python,代码行数:27,代码来源:koch.py

示例3: 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

示例4: __init__

    def __init__(self):
        turtle.title('Phogo - CRM UAM')
        turtle.mode('logo')
        turtle.penup()

        #turtle.setx(turtle.screensize()[0] // 8)
        turtle.screensize(4000, 4000)
开发者ID:CRM-UAM,项目名称:Phogo,代码行数:7,代码来源:tortoise_turtle.py

示例5: display

    def display( self, text ):
        """Display the finished graphic until the window is closed.

        Might be better to display until key click or mouse click.
        """
        turtle.title( text )
        turtle.ht()
开发者ID:slott56,项目名称:HamCalc-2.1,代码行数:7,代码来源:gwgraphics.py

示例6: __init__

    def __init__(self, model):
        """Initialize the view at the starting of the application."""
        self.model = model

        self.cellWidth = self.CELL_WIDTH
        self.model = model
        self.gridSize = model.GRID_SIZE
        self.player = self.model.player1
        self.screen = turtle.Screen()
        self.gridWidth = self.CELL_WIDTH * self.gridSize
        self.playerGrid = self.player.getGrid(self.player.PLAYER_GRID)
        self.enemyGrid = self.player.getGrid(self.player.OPPONENT_GRID)
        self.iconsToDraw = []

        turtle.title('BATTLESHIP : {} vs {}'.format(
            self.model.player1.playerName, self.model.player2.playerName))
        self.__setScreen()
        self.__setColor()
        turtle.tracer(0, 0)

        gridWidth = self.gridWidth
        gridAnchorPoints = []
        gridAnchorPoints.append((
            -self.width/2 + self.GRID_MARGINLEFT,
            self.height/2 - self.GRID_MARGINTOP - gridWidth))
        gridAnchorPoints.append((
            self.width/2 - gridWidth - self.GRID_MARGINRIGHT,
            self.height/2 - self.GRID_MARGINTOP - gridWidth ))

        self.__drawGrid(gridAnchorPoints[0], gridWidth)
        self.__drawGrid(gridAnchorPoints[1], gridWidth)

        self.gridAnchorPoints = gridAnchorPoints
开发者ID:raphaelgodro,项目名称:BattleShip-Human-AI-Network,代码行数:33,代码来源:view_window.py

示例7: main

def main():
    #用户输入一个文件名
    filename = input("enter a filename: ").strip()
    infile = open(filename, 'r')

    #建立用于计算词频的空字典
    wordCounts = {}
    for line in infile:
        processLine(line.lower(), wordCounts)

    #从字典中获取数据对
    pairs = list(wordCounts.items())

    #列表中的数据对交换位置,数据对排序
    items = [[x,y] for (y,x) in pairs]
    items.sort()

    #输出count个数词频结果
    for i in range(len(items)-1, len(items)-count-1, -1):
        print(items[i][1]+'\t'+str(items[i][0]))
        data.append(items[i][0])
        words.append(items[i][1])
    infile.close()

    #根据词频结果绘制柱状图
    turtle.title('词频结果柱状图')
    turtle.setup(900, 750, 0, 0)
    t = turtle.Turtle()
    t.hideturtle()
    t.width(3)
    drawGraph(t)
开发者ID:944624574ws,项目名称:python,代码行数:31,代码来源:dictionary.py

示例8: init

def init():
    t.setworldcoordinates(0,0,
        WINDOW_WIDTH, WINDOW_HEIGHT)
    t.up()
    t.setheading(90)
    t.forward(75)
    t.title('Typography:Name')
开发者ID:krishRohra,项目名称:PythonAssignments,代码行数:7,代码来源:typography.py

示例9: turtleProgram

def turtleProgram():
    import turtle
    import random
    global length
    turtle.title("CPSC 1301 Assignment 4 MBowen") #Makes the title of the graphic box
    turtle.speed(0) #Makes the turtle go rather fast
    for x in range(1,(numHex+1)): #For loop for creating the hexagons, and filling them up
        turtle.color(random.random(),random.random(),random.random()) #Defines a random color
        turtle.begin_fill()
        turtle.forward(length)
        turtle.left(60)
        turtle.forward(length)
        turtle.left(60)
        turtle.forward(length)
        turtle.left(60)
        turtle.forward(length)
        turtle.left(60)
        turtle.forward(length)
        turtle.left(60)
        turtle.forward(length)
        turtle.left(60)
        turtle.end_fill()
        turtle.left(2160/(numHex))
        length = length - (length/numHex) #Shrinks the hexagons by a small ratio in order to create a more impressive shape
    turtle.penup()   
    turtle.goto(5*length1/2, 0) #Sends turtle to a blank spot
    turtle.color("Black")
    turtle.hideturtle()
    turtle.write("You have drawn %d hexagons in this pattern." %numHex) #Captions the turtle graphic
    turtle.mainloop()
开发者ID:trsman44,项目名称:Fall-2015,代码行数:30,代码来源:MatthewBowenA4.py

示例10: main

def main():
    fileName = input('input a file name:').strip()
    infile = open(fileName, 'r')
    
    wordCounts = {}
    for line in infile:
        processline(line.lower(), wordCounts)
    
    pairs = list(wordCounts.items())
    items = [[x, y] for (y, x) in pairs]
    items.sort()
    for i in range(len(items)):
        if items[i][1] == ' ':
            items.pop(i)
    for i in range(len(items)-1, len(items)-count-1, -1):
        print(items[i][1]+'\t'+str(items[i][0]))
        data.append(items[i][0])
        words.append(items[i][1])
    infile.close()
    
    turtle.title('wordCounts chart')
    turtle.setup(900, 750, 0, 0)
    t = turtle.Turtle()
    t.hideturtle()
    t.width(3)
    
    drawGraph(t)
开发者ID:lovexleif,项目名称:python,代码行数:27,代码来源:zimuCounts.py

示例11: main

def main():
    turtle.title('数据驱动的动态路径绘制')
    turtle.setup(800,600,0,0)
    #设置画笔
    pen = turtle.Turtle()
    pen.color("red")
    pen.width(5)
    pen.shape("turtle")
    pen.speed(5)
    #读取文件
    result = []
    file = open("C:\Users\30908\Desktop\wode.txt","r")
    for line in file:
        result.append(list(map(float,line.split(","))))
    print result
    #动态绘制
    for i in range(len(result)):
        pen.color((result[i][3],result[i][4],result[i][5]))
        pen.fd(result[i][0])
        if result[i][1]:
            pen.rt(result[i][2])
        else:
            pen.lt(result[i][2])
    pen.goto(0,0)
    file.close()
开发者ID:godLYC,项目名称:hello-world,代码行数:25,代码来源:turtle.py

示例12: drawSetup

def drawSetup(title,xlimits,xscale,ylimits,yscale,axisThickness=None):
	turtle.title(title)
	xmin, xmax = xlimits
	ymin, ymax = ylimits
	#turtle.setup(xmax-xmin,ymax-ymin,0,0) #window-size
	globals()['xmin'] = xmin
	globals()['xmax'] = xmax
	globals()['ymin'] = ymin
	globals()['ymax'] = ymax
	globals()['xscale'] = xscale
	globals()['yscale'] = yscale

	turtle.setworldcoordinates(xmin,ymin,xmax,ymax)
	#turtle.speed(0) #turtle.speed() does nothing w/ turtle.tracer(0,0)
	turtle.tracer(0,0)

	drawGrid()
	#drawGridBorder()
	
	turtle.pensize(axisThickness)

	drawXaxis()
	drawXtickers()
	numberXtickers()
	
	drawYaxis()
	drawYtickers()
	numberYtickers()

	turtle.pensize(1)
开发者ID:Cacharani,项目名称:Graph-Kit,代码行数:30,代码来源:graphkit.py

示例13: __init__

    def __init__(self):
        # Janela sobre
        self.janSobre = None


        # Cor de fundo
        self.corFundo = "gray"


        turtle.screensize(1000, 700, self.corFundo)
        turtle.setup(width=1000, height=700)
        turtle.title("cidadeBela - Janela de desenho")


        turtle.speed(0)
        turtle.tracer(4)

        # Definindo variáveis globais
        self._tamPadrao = ""

        # Listas de prédios
        self.predios = ['Casa', 'Hotel']
        self.prediosProc = [ 'hotel', 'hotelInv', 'casa', 'casaInv' ]


        # Sorteando elementos
        self.sorteioPredios    = [["casa", 1], ["hotel", 1]]
        self.sorteioPrediosInv = [["casaInv", 1], ["hotelInv", 1]]


        #  Cores dos prédios
        self.coresHotel = ["076080190", "255255255", "167064057", "153204255", "000090245",
                           "201232098", "255058123", "010056150", "130255255", "255255000",
                           "255000000", "255127042", "000255000", "255170255", "000255170",
                           "212000255", "170255127", "127212255", "255127127", "255212085",
                           "212212255", "255255127", "222202144" ]
        self.coresCasa  = ['209187103', '115155225', '130047006', '255137111', '203229057',
                           '017130100', '025195159', '204057065', '194082255', '092221159',
                           '167045055', '238243030', '069241248', '000156228', '159094040',
                           '048033253', '040209239', '138164253', '190042177', '000122159',
                           '255255255', '253208201', '245228133']
        self.coresLoja  = ['255255255', '253208201', '245228133' ]

        #  Janelas dos prédios
        self.janelasHotel = janelas.janelasHotel
        self.janelasCasa  = janelas.janelasCasa
        self.janelasLoja  = janelas.janelasLoja
        self.janelasTodas = janelas.janelasTodas

        #  Tetos dos prédios
        self.tetosHotel = tetos.tetosHotel
        self.tetosCasa  = tetos.tetosCasa
        self.tetosLoja  = tetos.tetosLoja
        self.tetosTodas = tetos.tetosTodas

        #  Portas dos prédios
        self.portasHotel = portas.portasHotel
        self.portasCasa  = portas.portasCasa
        self.portasLoja  = portas.portasLoja
        self.portasTodas = portas.portasTodas
开发者ID:SrMouraSilva,项目名称:Academic-Projects,代码行数:60,代码来源:cb.py

示例14: main

def main():
    bob = turtle.Turtle()
    turtle.title('Sun Figure')
    turtle.setup(800, 800, 0, 0)
    bob.speed(0)
    bobMakesASun(bob, 1, 'purple')
    turtle.done()
开发者ID:enterth3r4in,项目名称:Shapes-,代码行数:7,代码来源:Shapes.py

示例15: main

def main():
    # set up the name of the window
    turtle.title("Polygonville")
    # setup the screen size through (1000, 650)
    # setup the initial location through (0,0)
    turtle.setup(1000,650,0,0)
    print("Welcome to Polygonville!")
    totalSides = input("Input number of sides in the polygon: ")
    while totalSides != 0:
        if totalSides < 3:
            print("Sorry, " + str(totalSides) + " is not "
            + "valid, try again or press 0 to exit")
        elif totalSides == 3:
            totalAngles = 180 * (totalSides - 2)
            sideLength = input("Put polygon sidelength: ")
            angle = totalAngles/totalSides
            func1(totalSides, sideLength, angle, totalAngles)
        else:
            totalAngles = 180 * (totalSides - 2)
            sideLength = input("Put polygon side length: ")
            angle = totalAngles/totalSides
            func2(totalSides, sideLength, angle, totalAngles)
        if totalSides > 3:
            print("Polygon Summary: \n" + 
                "Sides: " + str(totalSides) + "| Anterior Angle: " + 
                str(angle) + "| Sum of Angles: " + str(totalAngles))
        totalSides = input("\nInput number of sides in the polygon: ")
    if totalSides == 0:
        print("Thank you for using Polygonville!")
开发者ID:hifzasakhi,项目名称:Polygonville,代码行数:29,代码来源:polygonville.py


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