Python - IDLE Crashes when Scrolling - python-3.x

With Python 3.7.1 (installed with Homebrew) on macOS Mojave 10.14.1, whenever I scroll using the trackpad while using IDLE for python scripting, the IDLE window crashes. So much as moving along the trackpad in any way while in the IDLE window causes it to crash.

Related

Corrupted visual from python chromeos linux

I am using a chromebook with linux beta turned on to use a terminal to run python3 scripts. they worked fine until recently when any pop out window (pygame, pyplot) look corrupted. the windows have black bars covering them for pyplot or are completely covered in black for pygame. the code in the python scripts are unchanged and worked just fine a couple of weeks ago.
I have already turned off linux beta, then returned it back on, reinstalling packages which didn't alleviate the issue. Any help is IMMENSELY appreciated!!
I installed Qt5 bindings via pip install PyQt5 and changed the backend to Qt5Agg per How to change backends in matplotlib / Python and that fixed the black bars for me.

Tkinter crashes computer after MacOS 10.14.6 update

After updating my 2019 Macbook Pro yesterday to MacOS Mojave 10.14.6, a tkinter application that I have packaged with pyinstaller now crashes my computer. The screen turns black for a second, and then restarts to the login screen. When I run the program through the command line (unpackaged), it runs just fine.
The error code that appears several times in terminal is: CGSTrackingRegionSetIsEnabled returned CG error 268435459.
The research I've done has led me to these links:
This unanswered StackOverflow question
This semi-related SuperUser question
This question on the Japanese Q&A site teratail
The unanswered StackOverflow question is slightly different than my own problem, as it seems that that user cannot create a Tk() window at all, whereas I can create a Tk() window (including the Python IDLE), but it breaks when I package it with pyinstaller.
The SuperUser question is unanswered, but as one of the answers suggest I have uninstalled and reinstalled pyinstaller to no avail.
The question on teratail was answered, and says that the problem was fixed by uninstalling "Anaconda", but I don't know what Anaconda is or how to uninstall it.
I suspect that this is a problem with the MacOS update, and that there is nothing I can do to fix it and I'll have to wait for a patch.
Why is this happening? How can I fix it?
This problem has troubled me for a long time. My macOS version is 10.14.6 (Mojave). Running tkinter will crash the system, but I don’t want to update macOS version to 10.15 (Catalina) for this problem.
I got a solution by updating the python version.
My own test results, python versions 3.8.2 and 3.8.3 can fix the problem, but python versions 3.8.1, 3.7.x, 3.6.x will cause the crash.
I can confirm that this happens with Python 3.7.x. Moving to 3.8.3 fixes the problem.
Workaround: boot in Safe Mode..
(Other apps are experiencing this.)
The macOS Window Server is crashing..
The Console.app contains the crash report in the "System Reports" node.
Process: WindowServer
Thread 0 (main thread) crashes in CGXBeginSurfaceLayerUpdate
I had the same problem with Mac OSX 10.14.6 completely crashing with no error messages and logging me out or rebooting. It was fixed by removing Anaconda and using the python.org ver 3.7.4. A good link for removing Anaconda is here. How to uninstall Anaconda completely from macOS
The new MacOS Catalina (Version 10.15) update seems to fix the problem for me. By specifying the tcl version and making sure the right tcl is used, I was able to successfully bundle and run my python script with tkinter. Yay!

Opening Python IDLE from Raspberry Pi

Hi I have bought a Rasberry Pi with Python 3 on it. I can open the Python 3 shell and it works but I can't access an editor. How do I open a Python editor?
cheers
While the standard distribution of Python comes with IDLE, many Linux distributions do not include it. After you launch Python from command line, try the Python command,
>>> from idlelib import idle
That should start up IDLE with the same version of Python you started, regardless of how your symlinks are set up, if you have it installed for that Python version at all. If not, try installing IDLE with your package manager.
In case you are unfamiliar with IDLE, note that unless you open a file with it, IDLE starts with a Python shell window only. You can open a new IDLE editor window from the file menu of the IDLE shell window.
If you are using Python 2 type idle in a command window.
If you are using Python 3 type idle3 in a command window.
If you are using a GUI there should be shortcuts to IDLE and IDLE3 on screen.

Why does Spyder not display my graphics output anywhere when I am using Pygame?

I managed to install Pygame into my MacOS anaconda python 3.6 instance -- I simply put it into the "root" environment. The way I installed -- when I knew that the anaconda python was activated, I simply went to the command line and did pip install pygame.
But now, when I am in Spyder, and I load up a smallish python app that I wrote that uses Pygame, the app seems to run OK with no errors BUT it does not show the graphics output in any window or tab anywhere! I've tried alt-tabbing around... [For comparison... when I tried to run another small app I made that uses tkinter, then it presents the graphics by creating a separate app/window I can alt-tab to... shows a feather as the icon for that window when I alt tab to it.]
I played a little with the Spyder preferences>Ipython preferences>graphics... tried "Automatic," "inline," and Tkinter... none had any effect.
Two supporting things:
1-- note that, when I run anaconda's Spyder from the command line, for some reason it shows this string of warning errors... any tips on this for me? It is:
Erics-MacBook-Pro:~ ericstephan$ spyder
[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0
[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0
[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0
[[and six more lines of the same]]
2-- If it helps troubleshoot, below I will paste my pygame-using app whose graphics appears nowhere in Spyder. Makes many many little confetti sprites that flutter and bounce. Hey, it's a fun little app, if you replace numdots with something big like 500, it's pretty cool... when it's visible!
Here is the problem pygame app: Stackexchange editor wouldn't allow it so you can see it at https://pastebin.com/1Aa8pVDq
The problem is not with spyder but with Qt (graphics library for spyder).
Current Qt version in Anaconda does not support macOS sierra. For more details: stackoverflow.com - Problems with Spyder 3 in macOS 10.12 (Sierra) or higher

Invoking Python IDLE on Linux

I am trying to set up a Python development environment. I have Python 2.7.3 running on Linux Mint 14. I downloaded IDLE and installed it. It clean installs and Python runs just fine.
So how do I invoke IDLE? There isn't any IDLE in my path: which idle returns nothing. man idle returns nothing pertaining to an editor. Nothing in /usr/lib or /usr/local/lib. Calling idle() inside the Python interpreter doesn't work. Invoking python brings up a shell, not IDLE. No menu entry for IDLE in Linux. No import library named IDLE that Python can find. Three O'Reilly books consulted and not a word about invoking IDLE in Linux. YouTube videos of Python favor Windows, not Linux. Web searches have so far been unsuccessful.
I'm not familiar with Mint myself, but since it claims to be Debian-based, try installing the idle package:
sudo apt-get install idle
That should pull in all the appropriate packages for the installed version of Python. Then you should just be able to start IDLE with:
idle
in a terminal window.

Resources