turtle-graphics

    0熱度

    2回答

    我有一些代碼如下: # My code here turtle.bye() 之後,有沒有什麼辦法,我可以重新打開龜窗口。 我知道你可以做turtle.clearscreen()但這並不能關閉烏龜窗口。 我會接受任何答案,允許我關閉龜圖形窗口,然後重新打開它,而無需打開並運行另一個python程序來執行此操作。 預先感謝您

    1熱度

    1回答

    我要讓裝載機,像這樣的: 這是到目前爲止我的代碼: import turtle, random # random for colour choice, turtle for design turtle.hideturtle() # don't show arrow turtle.pensize(10) # thick pen turtle.colormode(255)

    0熱度

    1回答

    import turtle t=turtle.Turtle() wn=turtle.Screen() wn.setworldcoordinates(-300,-300,300,300) directions = { #dictionary of directions given in file. 'up': turtle.up, 'down': turtle.down }

    0熱度

    1回答

    我試圖加1我每次釋放鍵的屬性: from turtle import * import turtle turtle1 = Turtle() screen = turtle1.getscreen() goPressed = False 進口烏龜...... currentWatts=0 def onaclicked(): global currentWatts c

    0熱度

    1回答

    我有一個列表,其中每個元素都是一隻烏龜,並試圖讓一隻烏龜從列表中移除並隱藏。到目前爲止,我曾嘗試: lis[lis.index(food)].ht() lis[lis.index(food)].clear() lis.remove(lis.index(food)) 然而,當我運行它,我得到一個錯誤,指出該元素是找不到的。

    0熱度

    2回答

    我的目標是用蟒龜繪製一棵二叉樹,意思是每條線分成2條,每條分支到另外兩條等,從左到右,看起來像,除了從左到右水平。這是我到目前爲止所擁有的,並且它可以工作,但是如果你運行它,你很快就會意識到它在很多方面都是混亂的。 def tree(d,x1,y1): #d is the depth if d==0: #base case return 0 a = t

    2熱度

    1回答

    我正在嘗試製作一個程序,要求用戶繪製一個形狀,並在Python龜中繪製多少形狀。我不知道如何製作對話框,以便用戶可以說要添加多少個並使其正確運行。任何幫助將是真棒!這是我到目前爲止的代碼: import turtle steps = {"triangle": 3, "square": 4, "pentagon": 5, "hexagon": 6, "octagon": 7} #this i

    0熱度

    1回答

    我一直在嘗試保存圖像,爲我的手寫文本識別項目捕獲手寫文本。爲此目的,我正在使用蟒蛇龜。我想通過移動鼠標來改變畫布上的烏龜座標(在筆的位置),並通過按住鼠標左鍵移動鼠標來使其寫入(在筆向下的位置)。我無法實現這一點。這是我的代碼。 import tkinter import turtle sc = tkinter.Tk() sc.geometry("1000x1000+100+100")

    0熱度

    1回答

    我有一個遊戲,我嘗試做,但是當我創建我的屏幕和我的烏龜時,我的烏龜出現在與我製作的屏幕不同的屏幕上。 如果我要運行代碼,它將彈出2個不同的烏龜屏幕A:我稱爲屏幕的屏幕,B:當您創建一個沒有屏幕的烏龜時會自動彈出的屏幕。 import turtle from turtle import * from turtle import Screen import tkinter from tkint

    0熱度

    4回答

    基本上,我試圖在家裏使用烏龜模塊,因爲我一直在學校使用它,它使用起來相當有趣。但是,當我嘗試導入並運行代碼時,它說代碼的第1行出現錯誤,並且說沒有找到名爲pygame的模塊。我沒有寫pygame,我專門寫了 from turtle import * 哪個在學校工作得很好。我的電腦和學校的電腦都使用Python 3.6,但烏龜模塊只能在家使用。任何想法,爲什麼這可能會發生?如果有幫助,我試着在過