turtle-graphics

    0熱度

    1回答

    我做了一個毛毛蟲遊戲,現在我試圖將它轉換成雙人遊戲。我製作了第二隻毛毛蟲並給了它控制。當我跑它時,葉子自動地來到毛毛蟲。 這裏是我的代碼: import random import turtle as t t.bgcolor('yellow') caterpillar = t.Turtle() caterpillar.shape('square') caterpillar.color

    2熱度

    2回答

    下面是我的烏龜計劃,用於繪製一個黃色的房子。我無法想出一個方法來創建一個for循環,以保持烏龜程序的簡短。有沒有人有任何想法如何爲下面的程序創建一個循環? import turtle import math def yellowHouse() : wn=turtle.Screen() wn.title("Yellow House") wn.bgcolor("Blu

    0熱度

    1回答

    下面是使用龜圖形繪製房屋的代碼。爲了縮短代碼的長度,我需要幫助創建一個for循環。 import turtle wn = turtle.Screen() wn.bgcolor("Blue") house = turtle.Turtle() house.color("Yellow") house.pensize(5) house.speed(1) house.left(4

    0熱度

    1回答

    我運行Windows 10,無法用命令 from turtle import* 我收到以下消息打開龜屏幕: RESTART: C:/Users/xxxx/AppData/Local/Programs/Python/Python36-32/new.py 我試圖重新安裝,但不luck..can你幫助嗎?

    2熱度

    3回答

    標題,當我執行下面的代碼 import turtle turtle.write("some text") 我想知道整個尺寸(包括高度和寬度)烏龜圖形的畫布上的串some text的。 我該怎麼做?

    0熱度

    2回答

    這就是我到目前爲止。 turtle = turtle.Turtle() turtle.hideturtle() turtle.penup() turtle.goto(-200, -300) turtle.write("Hello World", move=False, align="left", font=("Candara", 30, "normal")) 我怎樣才能使這個文本

    0熱度

    1回答

    import turtle import time import random # randomizing the ball's Y scale pong_y = (random.random()) * 350 # setting screan size SIZE_X = 1280 SIZE_Y = 760 turtle.setup(SIZE_X, SIZE_Y) # the

    0熱度

    2回答

    我正在研究python的最後一個項目,用於我的Python入門介紹。我已經爲字母表中的每個字母編寫了代碼,我的想法是讓用戶輸入一些字詞,並返回所有輸入字母的代碼。我已經嘗試使用= 代碼爲龜,但這不起作用。有任何想法嗎?

    1熱度

    1回答

    我寫了下面的代碼,它在兩個隨機位置創建擴展正方形。我想寫一個函數f(方塊,秒),這樣如果用戶輸入f(5,10),一個新的正方形將開始形成每10秒,直到5個形成。 我似乎無法找到任何東西讓我開始一個新的廣場,而一個仍在形成。我可以同時製作兩種形式,如下面的代碼,或者完成一個,然後再另一個形成。幫幫我? import sys sys.setExecutionLimit(1000000) impor

    -3熱度

    1回答

    這是我的一段代碼: import turtle def draw_square(some_turtle): for i in range(1,5): some_turtle.forward(100) some_turtle.right(90) def draw_art(): window = turtle.screen() window.b