2017-02-21 256 views
0

我一直在尋找一個解決方案,但沒有雪茄...... 在我的CS類中,我們已經被分配到創建一個DOT和棋盤遊戲在Python龜和我試圖能夠使用onscreenclick()來檢測點擊區域並在遊戲進度中前進(即標題屏幕)。 我的代碼 -在Python中結束Onscreenclick()命令龜龜

def initial(): 
    color("white") 
    write("Dots and Boxes", align = "center", font = ("Arial", 100)) 
    penup() 
    setpos(0,-125) 
    pendown() 
    write("Want to play?", align = "center", font = ("Arial", 50)) 
    penup() 
    setpos(0,350) 
    pendown() 
    write("(Click to begin)", align = "center", font = ("Arial", 50)) 
    onscreenclick(main) 

def start(): 
    print("Click on a red dot to begin!(Choose wisely, this will be your turn): ") 


def main(x,y): 
    clear() 
    board() 
    start() 

initial() 

這也太創建標題畫面,並用命令的進展,問題是,該命令將不會每次點擊結束的話,主板是重繪! 感謝您的幫助! 親切的問候

回答

0

要禁用onscreenclick(main)簡單地做onscreenclick(None)(可能內main()),然後重做onscreenclick(main)當你再次想要的功能。