Python Forum
[Tkinter] Mouse click without use bind
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Mouse click without use bind
#2
There is no built-in way to handle Drag and drop, and the only way to do this is to create the functionality yourself.

Quote:is there another way than bind?

The only possible way to do this without bind is to create a low level listener (and this is essentially a home-grown bind), and you don't want to go there unless you thoroughly understand the interrupt process. Bind is a way to capture interrupts within your code, and you need not be afraid of them.

for drag and drop, you need to bind:
  • Button press (In tkinter this looks like <ButtonPress-1> )
  • Button move (In tkinter this looks like <B1-Motion> )
  • Button release (In tkinter this looks like <ButtonRelease-1>
It is not normal, nor needed to time the release, it's captured with the mouse up interrupt.

There are many examples of how to do this. It's quite simple to create your own,
you need create hooks for start, move and, stop activity.

Do a google search for: 'drag and drop for tkinter'

Please not that there is DRag and Drop support comming in ptrhon release 3.9.0 see: https://docs.python.org/3.9/library/tkinter.dnd.html
expected release in just 4 days (Oct 5) or you can download and install the release
see: https://pythoninsider.blogspot.com/2020/...Insider%29

you can find the code for this

if you can't find a suitable example with google,
come back, post your code, and I or another mod/admin will help you write one.

Finally: Perhaps it's time to consider my favorite wxpython, Kivy, or Qt5
Reply


Messages In This Thread
Mouse click without use bind - by ATARI_LIVE - Oct-01-2020, 11:59 AM
RE: Mouse click without use bind - by Larz60+ - Oct-01-2020, 05:35 PM
RE: Mouse click without use bind - by deanhystad - Oct-01-2020, 07:40 PM
RE: Mouse click without use bind - by Larz60+ - Oct-02-2020, 01:26 AM
RE: Mouse click without use bind - by ATARI_LIVE - Oct-02-2020, 09:18 AM
RE: Mouse click without use bind - by ATARI_LIVE - Oct-06-2020, 07:40 AM
RE: Mouse click without use bind - by deanhystad - Oct-06-2020, 05:46 PM
RE: Mouse click without use bind - by joe_momma - Oct-21-2020, 03:08 PM
RE: Mouse click without use bind - by ATARI_LIVE - Oct-23-2020, 10:41 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  tkinter - touchscreen, push the button like click the mouse John64 5 938 Jan-06-2024, 03:45 PM
Last Post: deanhystad
  [Tkinter] bind menator01 1 1,275 Apr-15-2022, 08:47 PM
Last Post: menator01
  [Tkinter] bind lambda keypress counter knoxvilles_joker 15 7,919 Apr-19-2021, 01:56 AM
Last Post: knoxvilles_joker
  [Tkinter] program unresponsive during pynput mouse click RobotTech 1 3,529 May-07-2020, 04:43 PM
Last Post: RobotTech
  [Kivy] AttributeError: 'NoneType' object has no attribute 'bind' faszination_92 2 6,324 Apr-12-2020, 07:01 PM
Last Post: Larz60+
  [WxPython] Bind error PeterLinux 1 2,270 Apr-06-2020, 03:07 AM
Last Post: joe_momma
  Tkinter:Unable to bind and unbind function with a button shallanq 2 5,077 Mar-28-2020, 02:05 AM
Last Post: joe_momma
  [Tkinter] Mouse click event not working on multiple tkinter window evrydaywannabe 2 3,803 Dec-16-2019, 04:47 AM
Last Post: woooee
  [Tkinter] How to bind an event when enter is pressed on a Entry control? Michael4 4 3,989 Aug-29-2019, 10:11 PM
Last Post: Michael4
  [PySimpleGui] How to alter mouse click button of a standard submit button? skyerosebud 3 5,065 Jul-21-2019, 06:02 PM
Last Post: FullOfHelp

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020