User avatar
joseplaselva
Posts: 92
Joined: Tue Oct 04, 2016 4:45 am
Location: Kvilla , Sweden

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

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 !!!!

dgordon42
Posts: 764
Joined: Tue Aug 13, 2013 6:55 pm
Location: Dublin, Ireland

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

Tue Sep 17, 2019 11:45 am

Code: Select all

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

Hope this helps,
Dave.

gkreidl
Posts: 6101
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

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

Tue Sep 17, 2019 11:46 am

sudo apt-get install idle-python3.7

If you still use Python 2:
sudo apt-get install idle-python2.7
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

Andyroo

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

Tue Sep 17, 2019 11:59 am

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>

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23710
Joined: Sat Jul 30, 2011 7:41 pm

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

Tue Sep 17, 2019 12:05 pm

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.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

User avatar
joseplaselva
Posts: 92
Joined: Tue Oct 04, 2016 4:45 am
Location: Kvilla , Sweden

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

Tue Sep 17, 2019 1:06 pm

Thanks for give me back the Phyton idle !!!
Thonny's layout looks fine, but why doesn't work with Tkinter GUI ???

hippy
Posts: 5980
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

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

Tue Sep 17, 2019 1:43 pm

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()

User avatar
joseplaselva
Posts: 92
Joined: Tue Oct 04, 2016 4:45 am
Location: Kvilla , Sweden

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

Tue Sep 17, 2019 2:16 pm

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'

danjperron
Posts: 3402
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

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

Tue Sep 17, 2019 2:21 pm

Hippy gives the answer in front of your nose.

in python3 it is tkinter

Andyroo

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

Tue Sep 17, 2019 2:22 pm

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.

hippy
Posts: 5980
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

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

Tue Sep 17, 2019 2:23 pm

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.

Andyroo

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

Tue Sep 17, 2019 2:50 pm

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...

User avatar
joseplaselva
Posts: 92
Joined: Tue Oct 04, 2016 4:45 am
Location: Kvilla , Sweden

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

Tue Sep 17, 2019 4:00 pm

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!!

User avatar
joseplaselva
Posts: 92
Joined: Tue Oct 04, 2016 4:45 am
Location: Kvilla , Sweden

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

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 :shock: :shock: :shock:

Code: Select all

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

Andyroo

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

Tue Sep 17, 2019 4:23 pm

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

hippy
Posts: 5980
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

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

Tue Sep 17, 2019 5:14 pm

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.

Return to “General discussion”