Patch Thonny to eliminate the ANNOYING horizontal scroll bar issue

Greetings!

Inviting @cleoqc and @mitch.kremm to the party, just in case they’re getting ready to rip Thonny outta their systems too!

If you use Thonny as I do to edit python files locally on your system, you will probably have noticed a glaring defect:

  • The horizontal scroll bar does not appear unless you navigate off the screen on a long line of text.

It turns out that this is a known bug, and even worse has been known for quite a while; AND  there’s even a fix documented on GitHub that has not bothered to make it into the code for several revisions - though everyone agrees it’s a problem.

Viz.:

(It is interesting that the person who documented the fix, Lurch, is the same “lurch” who is so instrumental and influential on the PINN forums.)

It is also interesting to note that this issue was raised on January 18, 2019, and even though Lurch’s fix was posted on May 31, 2020, it still has not made it into the current code-base which is 3.3.14 as of this instant date. (The current release on GoPiGo O/S is 3.3.10 - updating doesn’t do a damn thing for you)

What’s even MORE interesting is that the fix is TRIVIALLY EASY, as in “My wife Svetlana could do this” easy.

No more crying in the beer - let’s do it!

  1. Open a terminal window and type in
sudo mousepad /usr/lib/python3/dist-packages/thonny/ui_utils.py

(If that doesn’t work, substitute “leafpad” or whatever your text editor is for “mousepad”)

  1. Then go to line 944:
elif float(first) > 0.001 or float(last) < 0.009:

and change float(last)<0.009: to float(last)<0.999:

  1. Then save the file.
    That’s it.  Absolutely 100,000% of it.  The only thing left to do is restart Thonny if you have it open.

Or, do what I did.  Duplicate the line, comment out the old one and make the change in the copy.

Viz.:

Save the file and restart Thonny if you have it open.

Badda-bing, Badda-boom!
You have a version with a working horizontal scroll bar!

Come on guys. . . My granddaughters can do this.  What’s the big hold-up?

What say ye?

2 Likes

Just in case anyone’s interested - my second ever pull request.

Everyone was talking about it but, (huh?!!), nobody  had bothered to open a pull request to actually implement the change.
(:man_facepalming: )

So. . .  I did.  Maybe this will encourage someone to implement this in the next release?

Guess we’ll find out, won’t we.

2 Likes

Update:

Woo Hoo!  My first merge!

Apparently, my suspicion that it had “fallen through the cracks” was fully justified.

The push-comment from the maintainers was this:

I can’t take credit for the fix itself, but at least I gave it a “push”!  (:laughing:)

2 Likes

That’s exciting. Congrats!
/K

1 Like