Is there an alternative module for `simplegui` that can work in Google Colaboratory? - module

I need to find an alternative to simplegui module that can run in both Python and Google Colaboratory. It works in CodeSkulptor platform but gives errors in the other!

By Google collaboratory I guess that you mean CodeSkulptor:
https://py3.codeskulptor.org/
I reimplemented SimpleGUI in Python, with Pygame library, in the library SimpleGUICS2Pygame:
https://simpleguics2pygame.readthedocs.io/
With that you can run the same program both in CodeSkulptor and in standard Python 2 or 3.

Related

Can I use NAOqi 2.5 (C++/Python SDK) features on a NAOqi 2.9 (QiSDK) robot (Pepper)?

I have the Pepper robot running NAOqi 2.9, which is meant to use the QiSDK for its Android tablet. Things have been going well, but the photo capture rate is surprisingly slow (at most 2 fps), so I've got to use the C++ (or Python) SDKs available for NAOqi 2.5 for this particular task.
I've been trying to get it to work for a few days with no success. I have setup both the C++ and Python SDKs up and running, but the problem I'm facing is connection to the robot.
I've run the simple following code (using the robot's IP) found on the official website here
from naoqi import ALProxy
tts = ALProxy("ALTextToSpeech", "<IP of your robot>", 9559)
tts.say("Hello, world!")
and I'm getting the following output stream
after the second line
The connection problem occurs running either C++ on Ubuntu, or Python on Windows.
I can connect to the robot via SSH, FTP, QiSDK in Android Studio, but not in any way through the NAOqi 2.5 SDKs for C++ or Python. Since QiSDK was most probably build on top of the C++ SDK, there surely has to be a way to make this to work.
Any information will help immeasurably.
As far as I know, in NAOqi 2.5, the tablet (JavaScript) and the "brain" (Choregraphe i.e. Python / C++) of the robot were two independent devices and had to communicate and cooperate with each other. In NAOqi 2.9, the "brain" was moved to the tablet and the only way to program Pepper is by using Android Studio.
On the download page for Pepper NAOqi 2.9 (https://www.softbankrobotics.com/emea/en/support/pepper-naoqi-2-9/downloads-softwares), there is a comment regarding the Python SDK:
This is for old NAOqi 2.5.10 and NAOqi 2.5.5.
And the following is stated for NAOqi 2.9 / Pepper SDK Plugin [for Android Studio]:
This is all you need for Pepper NAOqi 2.9.
Therefore, according to Softbank Robotics' documentation, using Python / C++ to program a NAOqi 2.9 Pepper is not possible.
I hope this information answers your question.
Edit
There's another way, you can use the qi Python library inside Pepper's head, in order to use services, such as ALTextToSpeech or ALMotion, with a simple example here. One could also only use SSH to start a Python server, which would give access to these functionalities through endpoints.
import qi
app = qi.Application()
app.start()
session = app.session
tts = session.service("ALTextToSpeech")
tts.say("Hello Word")
If you run the above snippet inside Pepper's head it produces the expected output(saying Hello world). There are almost all the services that are documented here. You can also list them all by calling .services() on the session object
End of Edit
I finally found a way to hack into it. If you connect to the robot via SSH you can use the qicli binary. Its documentation is here
qicli info lists all services available, for example ALVideoDevice or ALMotion
qicli info ALMotion displays the available methods of that service
qicli info ALMotion.setAngles displays info about that method's parameters
qicli call ALMotion.setAngles HeadYaw 0.7 0.3 calls the function in the module with given parameters
So one could write a wrapper to this binary and call it programmatically via SSH, it seems like a lot of work for this kind of task but I haven't found anything else.
I've got Python's Paramiko library to work:
import paramiko
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(hostname='ip-of-robot', username='nao', password='your-pass')
stdin, stdout, stderr = client.exec_command('pwd')
print(stdout.read())
client.exec_command('qicli call ALMotion.setAngles HeadYaw -0.7 0.2')
client.close()
I've also tried .NET's SSH.NET library, with little to no success.

How to compile a Python script using Tensorflow to a .exe file to be used on a computer without Python and Tensorflow

I have created a working Python script containing a Tensorflow model that can identify images. I would like to compile this script in to some form of .exe file that can be used on computers without Python and Tensorflow installed. I would appreciate any help in this regard. Which programs and versions to use, how to use them and may be some code lines to guide me.
I have without luck tried py2exe, pyinstaller and cx_freeze. Currently I am using Tensorflow 2.0 and Python 3.7.0.
Thanks in advance.
I know you said you didnt have any luck with cx_Freeze but give it a try
I made a guide here answering someone elses question

"First steps with Tensorflow", how to access the data files outside of colab?

I'm Attempting to run "First steps with Tensorflow" locally, outside of colab. Not really familiar with colab so I don't know how to access the "dataframes" such as "california_housing_dataframe", etc. Evidently colab "knows" how to access the dataframes in the example but I am attempting to run the exercise natively on my local system.
Thank You
I think you should have Pandas library locally installed. Then, I think it would run natively.

GUI is not possible on Google Colab

I understand the GUI (such as those powered by tkinter) does not work on Google Colab, any alternatives at this point?
Error message
TclError: no display name and no $DISPLAY environment variable in google's colab
To use these notebooks you need to install binary MoebInv libraries and their dependencies.
In short, you simply need to execute it in CoLab or your Ubuntu-18.04 desktop the next cell

TensorFlow without jupyter notebook

Do I absolutely need to use jupyter notebook to run TensorFlow in Windows ?
I tried the detect object example with the jupyter notebook, it works but I'm not really comfortable, Im used to notepad++ and running python directly on my windows without virtual environment.
I tried to copy past all the codes but I run into many hugs.
No, it is not compulsory to use Jupyter notebook to run Tensorflow on Windows. I personally use PyCharm as my IDE and Anaconda for dependency management (this is completely optional).
I would recommend you to use a proper IDE instead of notepad++ because it's much easier to do debugging using an IDE. You'll also be cloning a lot from Git when you start developing your own model, and usually the open source models out there has a lot of classes and methods in it (take Google's Inception net for example).
Another alternative would be maybe you can start posting about the bugs you are facing, then we can all start helping you.