Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
カーソル(カメ)をキャンバスの右、左、下、上端に移動させる方法はありますか?
誰かが左端の位置に移動するためturtle.setx()に引数を使用することを提案しました。0しかし、そうすると、カメはデフォルトの位置(中央)に移動します。
turtle.setx()
0
window_width()およびwindow_height()関数を使用して、ウィンドウのサイズを決定します。
window_width()
window_height()
これにより、タートルが右端に移動します。
import turtle as tt def main(): tt.reset() print(tt.window_width(), tt.window_height()) tt.setx(tt.window_width()//2) if __name__ == '__main__': main() tt.mainloop()