[Idle-dev] bug or annoyance in IDLE on win32

Tal Einat taleinat at gmail.com
Wed Nov 5 14:07:26 CET 2008

<rt8396 at gmail.com> wrote:
> bug or annoyance in IDLE:
> Acutually this has to do with the tk Text widget.
> By default the Text widget binds mouse event "<Button-2>" to paste currently
> highlighted text. Now i guess this would not be a problem EXCEPT for the
> fact that
> IDLE does not have a Left/Right scroll bar, So the only way to scroll left
> and right is
> to hold down <B2> and move, causing the <B2> binding to be called, and in
> turn
> pasting text were you did not want it pasted. : -(
> Maybe there is a use for this but for me it just serves to frustrate me.
> Ok back to the solution:
> I know how to override this <B2> binding, i do it in all my programs that
> include a text editor. By inserting this line: text.bind_class('Text',
> '<Button-2>', lambda e: None)...and
> WHAMO no more annoying paste action...i love power :-D. I would love to code
> a
> solution and submit it to someone but only problem is i have looked through
> every module in idlelib and i cant make heads or tails of it. So i will have
> to leave this to someone more qualified than I.
> Couple of ways to solve this:
> 1. Allow users to rebind mouse events along with keyboard events...GOOD
>  (Power to the people!)
> 2. hack the code..BAD
> 3. write an extension that rebinds <B2> at runtime...UGLY
> 4. Add a left/write scrollbar to IDLE...BAD...i find draging with the mouse
> to be quicker

Thanks for bringing this up!

I think the most user-friendly way would be to add a preferences
option regarding this, e.g. a checkbox labelled "Mouse Button 2
(middle button) Pastes Current Text". However, cluttering up the
config dialog is also something to be avoided, and now that I think of
it, most users will probably not understand what that's for anyways.

We could just add this as a config option which can be manually
changed in the config files, without a way to change it in the config
dialogs. This way power users who want to change the behavior have a
relatively easy way, but others are not bothered with this option.

It seems to me that scrolling with Mouse Button 2 would be the
expected behavior for most users these days. Maybe this should be the
default? (If we do this, we could still consider making the 'paste'
functionality available via a config option.)

- Tal

More information about the IDLE-dev mailing list