Tkinter: Mouse drag a window without borders, eg. overridedirect(1)

后端 未结 5 1554
说谎
说谎 2020-11-27 20:18

Any suggestions on how one might create event bindings that would allow a user to mouse drag a window without borders, eg. a window created with overridedirect(1)

5条回答
  •  我在风中等你
    2020-11-27 21:07

    Try this, and it surely works;

    1. Create an event function to move window:

      def movewindow(event): root.geometry('+{0}+{1}'.format(event.x_root, event.y_root))

    2. Bind window:

      root.bind('', movewindow)

    Now you can touch the the window and drag

提交回复
热议问题