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.
たくさんの写真が入った Tkinter Canvas を持っていますが、それらをすべて簡単に移動する方法はありますか? 「canvas.move」については知っていますが、多くのオブジェクトに使用すると非常に反復的でクラスター化されます。キャンバス上のすべてのオブジェクトを同時に移動する方法はありますか、またはすべての画像を単一のオブジェクトに結合する方法はありますか (Python を使用)? 前もって感謝します。
ALLmove メソッドに定数を渡すことができます。
ALL
from Tkinter import * root = Tk() canvas = Canvas(root, width=200, height=200) canvas.create_rectangle(10, 10, 60, 60) canvas.create_rectangle(70, 70, 120, 120) canvas.pack() canvas.move(ALL, 50, 50) root.mainloop()