2017-02-21 42 views
0

私は解決策のためにしばらくは見てきましたが、葉巻はありません。 私のCSクラスでは、Python Turtleでドットとボードゲームを作成するように割り当てられました。私はonscreenclick()を使用してクリック領域を検出し、ゲームの進行状況(つまり、タイトル画面)を進めることを試みています。私のコード -Python Turtleで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)は、単に(おそらくmain()内)onscreenclick(None)を行い、その後、再度その機能が必要なときonscreenclick(main)をやり直し無効にします。

関連する問題