當前位置: 首頁>>代碼示例>>Python>>正文


Python turtle.title方法代碼示例

本文整理匯總了Python中turtle.title方法的典型用法代碼示例。如果您正苦於以下問題:Python turtle.title方法的具體用法?Python turtle.title怎麽用?Python turtle.title使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在turtle的用法示例。


在下文中一共展示了turtle.title方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: draw_koch

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import title [as 別名]
def draw_koch(n=3, polygon=6):
    """繪畫科赫雪花

    :param n: 迭代次數
    :param polygon: 多邊形雪花
    """
    pen = turtle.Pen()
    turtle.title('科赫雪花')
    pen.speed(0)
    r = pen.screen.canvwidth / 2
    pen.penup()
    pen.goto(-r, 0)
    pen.pendown()
    a = 180 - (polygon - 2) * 180 / polygon  # 計算多邊形旋轉的角度,計算公式
    # 多邊形的內角和公式(n-2)*180/n
    for i in range(polygon):
        angle = a * (1 - i)
        pen.setheading(angle)
        koch(pen, n, r)
    turtle.done() 
開發者ID:jtyoui,項目名稱:Jtyoui,代碼行數:22,代碼來源:KochSnowflake.py

示例2: setup_screen

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import title [as 別名]
def setup_screen(title, background='white', screen_size_x=640, screen_size_y=320, tracer_size=200):
    print('Set up Screen')
    turtle.title(title)
    turtle.setup(screen_size_x, screen_size_y)
    turtle.hideturtle()
    turtle.penup()
    turtle.backward(240)
    turtle.tracer(tracer_size)
    turtle.bgcolor(background)  # Set the background colour of the screen 
開發者ID:johnehunt,項目名稱:advancedpython3,代碼行數:11,代碼來源:mandelbrot.py

示例3: __init__

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import title [as 別名]
def __init__(
                self,
                screen_width = 800,
                screen_height = 600,
                background_color = "black",
                title = "Simple Game Library by /u/wynand1004 AKA @TokyoEdTech",
                splash_time = 3):

        # Setup using Turtle module methods
        turtle.setup(width=screen_width, height=screen_height)
        turtle.bgcolor(background_color)
        turtle.title(title)
        turtle.tracer(0) # Stop automatic screen refresh
        turtle.listen() # Listen for keyboard input
        turtle.hideturtle() # Hides default turtle
        turtle.penup() # Puts pen up for defaut turtle
        turtle.setundobuffer(0) # Do not keep turtle history in memory
        turtle.onscreenclick(self.click)

        # Game Attributes
        self.SCREEN_WIDTH = screen_width
        self.SCREEN_HEIGHT = screen_height
        self.DATAFILE = "game.dat"
        self.SPLASHFILE = "splash.gif" # Must be in the same folder as game file

        self.fps = 30.0 # Lower this on slower computers or with large number of sprites
        self.title = title
        self.gravity = 0
        self.state = "showsplash"
        self.splash_time = splash_time

        self.time = time.time()

        # Clear the terminal and print the game title
        self.clear_terminal_screen()
        print (self.title)

        # Show splash
        self.show_splash(self.splash_time)

    # Pop ups 
開發者ID:wynand1004,項目名稱:SPGL,代碼行數:43,代碼來源:spgl.py

示例4: print_game_info

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import title [as 別名]
def print_game_info(self):
        print (self.title)
        print ("")
        print ("Window Dimensions: {}x{}".format(self.SCREEN_WIDTH, self.SCREEN_HEIGHT))
        print ("")

        # Calcuate number of active sprites
        active_sprites = 0
        for sprite in Game.sprites:
            if sprite.state:
                active_sprites += 1

        print ("Number of Sprites (Active / Total): {} / {}".format(active_sprites, len(Game.sprites)))

        print ("Number of Labels: {}".format(len(Game.labels)))
        print ("Number of Buttons: {}".format(len(Game.buttons)))
        print ("")
        print ("Frames Per Second (Target): {}".format(self.fps))
        print ("")
        self.print_error_logs() 
開發者ID:wynand1004,項目名稱:SPGL,代碼行數:22,代碼來源:spgl.py

示例5: print_game_info

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import title [as 別名]
def print_game_info(self):
        print (self.title)
        print ("")
        print ("Window Dimensions: {}x{}".format(self.SCREEN_WIDTH, self.SCREEN_HEIGHT))
        print ("")

        # Calcuate number of active sprites
        active_sprites = 0
        for sprite in Game.sprites:
            if sprite.state:
                active_sprites += 1

        print ("Number of Sprites (Active / Total): {} / {}".format(active_sprites, len(Game.sprites)))

        print ("Number of Labels: {}".format(len(Game.labels)))
        print ("Number of Buttons: {}".format(len(Game.buttons)))
        print ("")
        print ("Frames Per Second (Target): {}".format(self.FPS))
        print ("")
        self.print_error_logs() 
開發者ID:wynand1004,項目名稱:SPGL,代碼行數:22,代碼來源:spgl.py

示例6: draw

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import title [as 別名]
def draw(self):  # 繪畫
        pen = turtle.Pen()
        turtle.title('康托三分集')
        pen.width(2)
        for index, dot in enumerate(self.dot):
            for x, y in dot:
                pen.penup()
                pen.goto(x=x, y=100 - index * 10)
                pen.pendown()
                pen.forward(y - x)
        turtle.done() 
開發者ID:jtyoui,項目名稱:Jtyoui,代碼行數:13,代碼來源:CantorTernarySet.py

示例7: setup_screen

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import title [as 別名]
def setup_screen(title, background='white', screen_size_x=640, screen_size_y=320, tracer_size=800):
    print('Set up Screen')
    turtle.title(title)
    turtle.setup(screen_size_x, screen_size_y)
    turtle.hideturtle()
    turtle.penup()
    turtle.backward(240)
    # Batch drawing to the screen for faster rendering
    turtle.tracer(tracer_size)
    turtle.bgcolor(background)  # Set the background colour of the screen 
開發者ID:johnehunt,項目名稱:advancedpython3,代碼行數:12,代碼來源:snowflake_koch.py

示例8: setup_screen

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import title [as 別名]
def setup_screen(title, background = 'white'):
    print('Set up Screen')
    turtle.title(title)
    turtle.setup(640, 600)
    turtle.hideturtle()
    turtle.penup()
    turtle.tracer(200)
    turtle.bgcolor(background)  # Set the background colour of the screen 
開發者ID:johnehunt,項目名稱:advancedpython3,代碼行數:10,代碼來源:snowflake.py

示例9: setup_screen

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import title [as 別名]
def setup_screen(title, background='white', screen_size_x=640, screen_size_y=320, tracer_size=200):
    """ Sets up Turtle screen with useful defaults """
    print('Set up Screen')
    turtle.title(title)
    turtle.setup(screen_size_x, screen_size_y)
    turtle.hideturtle()
    turtle.penup()
    turtle.backward(240)
    turtle.tracer(tracer_size)
    turtle.bgcolor(background)  # Set the background colour of the screen 
開發者ID:johnehunt,項目名稱:advancedpython3,代碼行數:12,代碼來源:fractal_trees.py

示例10: ask_yes_no

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import title [as 別名]
def ask_yes_no(self, title, message):
        return messagebox.askyesno(title, message) 
開發者ID:wynand1004,項目名稱:SPGL,代碼行數:4,代碼來源:spgl.py

示例11: show_info

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import title [as 別名]
def show_info(self, title, message):
        return messagebox.showinfo(title, message) 
開發者ID:wynand1004,項目名稱:SPGL,代碼行數:4,代碼來源:spgl.py

示例12: show_warning

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import title [as 別名]
def show_warning(self, title, message):
        return messagebox.showwarning(title, message) 
開發者ID:wynand1004,項目名稱:SPGL,代碼行數:4,代碼來源:spgl.py

示例13: show_error

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import title [as 別名]
def show_error(self, title, message):
        return messagebox.showerror(title, message) 
開發者ID:wynand1004,項目名稱:SPGL,代碼行數:4,代碼來源:spgl.py

示例14: ask_ok_cancel

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import title [as 別名]
def ask_ok_cancel(self, title, message):
        return messagebox.askokcancel(title, message) 
開發者ID:wynand1004,項目名稱:SPGL,代碼行數:4,代碼來源:spgl.py

示例15: ask_retry_cancel

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import title [as 別名]
def ask_retry_cancel(self, title, message):
        return messagebox.askretrycancel(title, message) 
開發者ID:wynand1004,項目名稱:SPGL,代碼行數:4,代碼來源:spgl.py


注:本文中的turtle.title方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。