Page 1 of 1

New Raspbian Buster and Thonny idle, "hate at first sight"

Posted: Tue Sep 17, 2019 11:20 am
by joseplaselva
I was so excited with the new Pi4 that I bought one to test, and what a great dissapoint, my beloved Python idle has been eliminated and now I can't run my scripts with tkinter in this Thonny idle, why this change, the new with the worst ... I hate. I am the only one suffering from this. Help my friends !!!!

Re: New Raspbian Buster and Thonny idle, "hate at first sight"

Posted: Tue Sep 17, 2019 11:45 am
by dgordon42

Code: Select all

sudo apt install idle3
will get your IDLE back for Python3.

Hope this helps,
Dave.

Re: New Raspbian Buster and Thonny idle, "hate at first sight"

Posted: Tue Sep 17, 2019 11:46 am
by gkreidl
sudo apt-get install idle-python3.7

If you still use Python 2:
sudo apt-get install idle-python2.7

Re: New Raspbian Buster and Thonny idle, "hate at first sight"

Posted: Tue Sep 17, 2019 11:59 am
by Andyroo
Try VS Code from Microsoft https://code.visualstudio.com/

It supports remote debugging on a Pi so you can use your Mac / Linux box / Pc and run direct on the Pi. Only drawback I can see is that the source is kept on the Pi with no local backup so I loose the advantage of TimeMachine.

One thing I’ve not tried is https://www.hanselman.com/blog/Building ... ryPi3.aspx - it may run nicely on a Pi 4 esp if directly connected to it...

Edit: Just dawned on me - I can set up Carbon Copy to copy the files from the Pi (Samba share) and use it’s archive capability :roll: (Not that I’ve lost any source yet though <fingers crossed gif here>

Re: New Raspbian Buster and Thonny idle, "hate at first sight"

Posted: Tue Sep 17, 2019 12:05 pm
by jamesh
joseplaselva wrote:
Tue Sep 17, 2019 11:20 am
I was so excited with the new Pi4 that I bought one to test, and what a great dissapoint, my beloved Python idle has been eliminated and now I can't run my scripts with tkinter in this Thonny idle, why this change, the new with the worst ... I hate. I am the only one suffering from this. Help my friends !!!!
You know that Idle was a bit rubbish*?

Anyway, just install it from the repo's as described above.



* My personal opinion. You have one, I thought I should too.

Re: New Raspbian Buster and Thonny idle, "hate at first sight"

Posted: Tue Sep 17, 2019 1:06 pm
by joseplaselva
Thanks for give me back the Phyton idle !!!
Thonny's layout looks fine, but why doesn't work with Tkinter GUI ???

Re: New Raspbian Buster and Thonny idle, "hate at first sight"

Posted: Tue Sep 17, 2019 1:43 pm
by hippy
joseplaselva wrote:
Tue Sep 17, 2019 1:06 pm
Thonny's layout looks fine, but why doesn't work with Tkinter GUI ???
It works fine for me in so far as I have tested it; so perhaps describe what problem you are encountering, what errors you are getting.

Code: Select all

#!/usr/bin/python

try    : from tkinter import * # Python 3
except : from Tkinter import * # Python 2

class Window(Frame):
  def __init__(self, root):
    Frame.__init__(self, root)
    self.root = root

app = Window(Tk())
app.root.mainloop()

Re: New Raspbian Buster and Thonny idle, "hate at first sight"

Posted: Tue Sep 17, 2019 2:16 pm
by joseplaselva
I use this in my script :

Code: Select all

from Tkinter import *

from PIL import Image, ImageTk

and in Thonny idle gives this error :

Code: Select all

Traceback (most recent call last):
  File "/home/pi/TK-snapshot.py", line 5, in <module>
    from Tkinter import *
  File "/usr/lib/python3/dist-packages/thonny/backend.py", line 305, in _custom_import
    module = self._original_import(*args, **kw)
ModuleNotFoundError: No module named 'Tkinter'

Re: New Raspbian Buster and Thonny idle, "hate at first sight"

Posted: Tue Sep 17, 2019 2:21 pm
by danjperron
Hippy gives the answer in front of your nose.

in python3 it is tkinter

Re: New Raspbian Buster and Thonny idle, "hate at first sight"

Posted: Tue Sep 17, 2019 2:22 pm
by Andyroo
The Thonny virtual environment may also be your issue :twisted:

Thonny runs a virtual environment on the Pi and you often have to import the module into Thonny as well as the normal operating environment.

What makes it worse is that there are two ways in Thonny to do this - one installs into the virtual environment only and one into the main libraries.

Sorry to say my VM is down at the mo (moving to Parallels on the Mac and tidying disks at the same time) and I have no Pi with a desktop handy today :oops: so I cannot help more than this.

Re: New Raspbian Buster and Thonny idle, "hate at first sight"

Posted: Tue Sep 17, 2019 2:23 pm
by hippy
from Tkinter import *

That is the module specification when using Python 2. Thonny only runs Python 3 code. For Python 3 you need to use, lowercase 't' -

from tkinter import *

There may be other changes required to make your Python 2 code work with Thonny and Python 3.

Python 2 goes 'end of life' from the start of next year so it is probably wise to start migrating now.

Re: New Raspbian Buster and Thonny idle, "hate at first sight"

Posted: Tue Sep 17, 2019 2:50 pm
by Andyroo
Thought you could set the Python version in Thonny or is that VS Code only?

Not that setting it back is a good idea mind you...

Re: New Raspbian Buster and Thonny idle, "hate at first sight"

Posted: Tue Sep 17, 2019 4:00 pm
by joseplaselva
Many thanks to all for help me to " see the light" :-) . I think I must start to migrate all my scripts to Python 3.
Have a nice evening all of you!!

Re: New Raspbian Buster and Thonny idle, "hate at first sight"

Posted: Tue Sep 17, 2019 4:11 pm
by joseplaselva
Sorry I forget to ask why in the new Raspian Buster downloaded has the Thonny idle that just run in Python 3 , when this new raspian runs on 2,7 version :shock: :shock: :shock:

Code: Select all

[email protected]:~ $ python --version
Python 2.7.16

Re: New Raspbian Buster and Thonny idle, "hate at first sight"

Posted: Tue Sep 17, 2019 4:23 pm
by Andyroo
The python command defaults to V2 to maintain compatibility with upstream Debian.

Code: Select all

python3
is the program you need.

As Thonny is part sponsored by the RPT/RPF folk, they took the decision (correctly in my mind) to go forward with v3 so new code created by schools etc using Thonny is the correct version.

See the long discussions elsewhere or live with it for now :lol:

Do not worry - it will get worse before it gets better - just be glad you are not at JP Morgan

Re: New Raspbian Buster and Thonny idle, "hate at first sight"

Posted: Tue Sep 17, 2019 5:14 pm
by hippy
joseplaselva wrote:
Tue Sep 17, 2019 4:11 pm
Sorry I forget to ask why in the new Raspian Buster downloaded has the Thonny idle that just run in Python 3 , when this new raspian runs on 2,7 version
It is all part of encouraging those new to Python to start with Python 3.

Raspbian will also move to Python 3, dropping support for Python 2, as time goes on.