How to use processing.py in google colaboratory - python-3.x

Recently I've been studying a lot on the processing library (mainly using p5.js) and was delighted to find out that in the processing IDE, there is a python mode, processing.py.
I want to try using it in google colaboratory. I tried using pip install to install it in colab and in the console it said it was installed successfully but when I try running a script that usually runs in the python mode of the processing IDE, it doesn't work. Below is a screen cap of the code and the error. In the processing IDE, (without the last 2 lines), this will show a 400 x 400 gray canvas with a circle drawn at its center.
I also tried installing java into the colab just in case processing.py requires java. Nothing seems to work though. For those who want to see the entire notebook, here is the link: https://colab.research.google.com/drive/19UVAR2iOWk4NnrHxNhd_XL03MUoKrCF3?usp=sharing It is set so that anyone with the link can open it.
I hope someone can help me with this. Thanks very much.

I'm afraid it is not possible to use https://py.processing.org on Colab, as it is based on the Jython interpreter, a Python 2 that runs on the Java Virtual Machine (the upside of Jython being that we can use most of the librairies created by the Processing Java community, available with a few clicks from the IDE).
You might be able to run this new experimental "Processing in Python 3" project on Colab: https://github.com/p5py/p5

There is a new p5 library in pyPI that can be installed:
!pip install -U p5
import p5
However, I have had problems getting the chart to show. I believe that the problem is getting Colab to write to my display. It would be great if someone could solve this...

Related

Python 3.10 - ModuleNotFoundError: No module named 'win32.win32ui'

I just updated my python from 3.7 to 3.10 and now there are import error's.
While I just needed for import win32gui turn into import win32.win32gui as suggested here. There seems no other syntax for import win32ui, after some research I found this github report that has been closed with:
That's very helpful, thanks, and I can reproduce this in visual studio
I didn't consider that an exception was being caught and ignored. Turns out we aren't holding the GIL when we call back into Python -
I've no idea why this is different in 3.9 vs other versions, but the
fix is simple and is safe in all versions.
While there is suggested to comment out a line in a file named win32control which I apperantly dont have or find. Neither it seems possible in my compiled files that looks like:
G Áàȉ x#;÷щ
Nor do I understand the wheel solution and what to do with it, since I am still a beginner with hobby experience in python programming.
Update I just found this Q&A but not sure if it is related.
While it helped me on my other device to just reinstall my older python version, as stated in the comment section:
#CristiFati thanks for your reply. Since I installed my earlier
version of 3.7.2 again pywin works fine even if I run the code with
IDLE Shell 3.10.
This wasnt possible on my new device, but the Running as a Windows Service helped me out this time.
Manually copy pythonservice.exe from the site-packages/win32 directory
to the same place as these DLLs.

Python Turtle Crashes MacOS

Yes, I know there are already questions with a similar title, but I couldn't find a solution.
My problem is that whenever I use turtle, it crashes the entire computer. A video is attached here. This works with any turtle command, not just the one shown. It also crashes when I use any interpreter, not just the terminal.
I am running MacOS Mojave 10.14.6, with python 3.7.
Thank you for any help you may have.

OpenCV 3.x Documentation in PyCharm

I've compile OCV 3.4 on my Mac. Everything runs fine, PyCharm works, QT5 bindings are fine.
I have one problem: Don't know how to add the documentation for OCV in PyCharm.
I know it's under ExternalDocumentation but how do I specify the right path???
I have the generate doc files on my HD (OpenCV/doc/html and OpenCV/doc/javadoc)
I have installed opencv-python via pip install opencv-python (see https://pypi.org/project/opencv-python/ for more details) and now I can see all the docs with Ctrl+Q shortcut. The only problem, I was not able to get a nice formatting:
Help on openCV function in the Documentation tool window
Still it simplifies things a lot comparing with the manual installation I had before.

GTK+, GLADE, PYTHON 3.6 Windows

I am an Electrical engineer. I am completely new for programming and coding..
Actually i am working as estimation engineer, where i am doing the same estimation again and again with excel.
As same in design stage also i am doing the same again and again.
I thought i will create a application which will automatically do the estimation based on my input. and the same time at the time of design stage it will input from my estimation sheet it will generate the drawing automatically.
(i am doing estimation in excel, preparing drawing in auto cad)
from google, i found the following..
To write a program I need to know a language. so i selected python version 3.6.1
To create a stand alone or micro soft windows installer i selected cx freeze which is converting my code to .exe filex
To create a user interface i selected glade.
But i dont know how to install gtk builder to link pythin code and glade files.
Hopefully you got the point what i am looking..
I am using windiws 10 with 64 bit version
Advance thanks for all
All the information you need on how to install GTK+ and Glade on Windows is on the GTK+ Website.
However, If you're a total beginner, then I suggest you start small, as the kind of work you're describing seems a lot of work for someone who has never written a single line of code.
As suggested by #liberforce, install GTK+ and Glade on Windows from their GTK+ Website. This way you will have an environment (MINGW64) inside which you can practice.
Install python from their download site.
Check also these instructions for how to use it.
The key points (at least for me) are:
Copy the hello.py script you created to C:\msys64\home\<username>
In the mingw32 terminal execute python3 hello.py - a window should appear.
After that, if you want to make an executable, follow these instructions. Try their example for gedit to get some ideas on how to create and how PKGBUILD works (a.k.a. follow the instructions for gedit to see what's happening).

Matplotlib for Python 3 and Linux

I understand that Matplotlib has been ported to Python 3 (matplotlib-python-3-thanks-cape-town-group).
However, it seems that I can only find Windows executables.
The matplotlib-py3 page claims that it was merged into Matplotlib.
Does anybody knows where I can find Matplotlib 1.2 development branch most likely to work on Linux. Does anybody successfully use it with Python 3?
As #ThomasK mentioned, the git master branch is the place to get the current Python3 compatible version of matplotlib, and it will be where v1.2 is cut from. If there are any problems that come up, please file them as bugs.
Just a heads up that there will soon be a bug-fix only v1.1.1 release, which will still not be Py3k compatible, so when you hear about it, please ignore it as far as Python3 is concerned.
I know this is a pretty old question, but I'm currently able to use matplotlib (1.2) with python3 using pip:
pip-python3 install matplotlib
worked for me, using python 3.3.

Resources