Running python script with tkinter on iphone - python

not sure if possible, maybe someone has sucess
I have a little python script for my university exams and it will be great to show execution on the mobile. It uses tkinter for the GUI (I know, probably not the best, but it has been done like this)
I have it running on Android (not my phone) within Pydroid3 without any problem, but I can not replicate in iphone
so far i have tried Python3IDE and CodeSnackIDE (among others that can not get even python to work)
Python3IDE
as it seems terminal do not support sudo, neither apt-get, no change to install tkinter
CodeSnackIDE
successfully installed tkinter, using the instructions as:
https://docs.codesnack-ide.com/Python-using-Pipenv-5a77effdbad44930b7927a37e25d4c45
(after pipenv run sudo apt-get install python3-tk)
but i would say that the running is remote, and do not have display, can it be?
trying using tkinter raise the error:
couldn't connect to display :1
and after running export DISPLAY=unix$DISPLAY
(as local machine _tkinter.TclError: couldn't connect to display ":0")
couldn't connect to display unix:1
Am I trying something never done before?
or something not meant to be done ... :_(
I know there is posts like:
Is it possible to use Tkinter to create an app for Android or iOS?
and not sure if this fully applies

Related

How to use cec control in python

I am trying to write a simple loop in python that can turn of and on your tv using CEC control. But, whenever I try to "import cec" into my program it doesn't work. I am new to programing and I don't really know where to start.
looking at the error, it looks like you didn't install it. so, using your terminal in your editor, paste or type
pip install pyCEC
you can check the website here
and if it didn't work restart you editor.
then it will work perfectly.
It looks like cec is a python package: https://pypi.org/project/cec/
Depending on your python installation, you can likely install it with pip install cec.
See this documentation on getting started with python packages for more:
https://packaging.python.org/tutorials/installing-packages/

Windows 10 notifications in python

I've tried a lot of methods found online to create notification bubbles through python, but none of them work. I suspect this has something to do with windows just not allowing them for the script, but how can I solve this?
For example, using the balloontip snippet, and in my own script:
import balloontip
Following with either of these just doesn't show any toast.
w=balloontip.WindowsBalloonTip('asdf', 'qwerty')
balloontip.balloon_tip('asdf', 'qwerty')
I've also tried using the win10toast package but still no such luck.
What's even weirder is that solutions entirely unrelated to python also don't work. For example this powershell script creates an icon in my tray but the message won't show.
Try to import all the modules used in the snippet, and include the snippet in your script. You might need to install win32api using pip install pypiwin32
This might help you identify the problem/check if it is indeed a problem with Windows notifications in general.
I was able to create a notification by adding the following code to the end:
balloon_tip("test title", "test message")
Check if you have blocked windows notifications:
http://www.howto-connect.com/disable-enable-app-notifications-on-windows-10/

How to import third party python module Mac OS X - anki

I am relatively new to programming and posting to Stack Overflow. Please forgive my ignorance.
I am attempting to use a third party module in a program of my own, however I can't work out how to access the module within my Python script.
Mac OS X Sierra 10.12.4
Python 3.6.1
Anaconda 4.3.1
Specifically, I would like to be able to access anki (https://github.com/dae/anki).
I initially tried the line:
from anki import Collection
That resulted in a 'ModuleNotFoundError'.
Next I tried:
conda install anki
which also didn't work and yielded a 'PackageNotFoundError'
After more searching, I decided to try:
import sys
sys.path.append('usr/share/anki')
from anki import Collection
However, this also results in a 'ModuleNotFoundError'
What do I need to do to be able to access this module?
I am sure that it is possible because I have come across several other programs which make use of it:
-https://eshapard.github.io/anki/open-the-anki-database-from-python.html
I recognize that the link above purports to offer a solution to exactly this problem, however the solution proffered isn't working for me. Thanks in advance.
You are telling about Anki for desktop computers, which IS application written in Python, but it is NOT an installable Python package.
So the commands like
conda install anki
or
pip install anki
have no meaning.
So the only way is to download full source code of this project, unzip the content of it (only) folder into your project (change you actual folder to it) and then you may do import commands.

Python Illegal instruction on Raspberry Pi Zero

When I try to run a python script I get Illegal instruction and that's it, it doesn't give any more details so I have no idea what's going on, is there a way to find out what is causing the Illegal instruction error?
Also, I run the code using sudo I don't get any output, the program just exits.
UPDATE:
The script I'm running is the simple-agent script from bluez:
https://github.com/pauloborges/bluez/blob/master/test/simple-agent
Also, I ran line by line like #buratino said and I got the error in the second line:
from gi.repository import GObject
Like #Notlikethat said, the Illegal instruction error happens when the code being executed was compiled for a different architecture, Raspberry Pi uses ARM.
That said, I found out that GObject seemed to be causing the problem. Anyway, I uninstalled every bluetooth related package I had installed and reinstall them using the raspbian repository and now the Illegal instruction is gone and the script executes correctly.
Why did this happen? Well, I have a Raspberry Pi Zero which means I don't have an Ethernet port, before I bought a WiFi dongle I installed a few packages by downloading them on my computer and storing the .deb in the SD card, of course this means I have to manually check that I'm downloading the right version of the package, I must've messed up in one of them.
Lesson learned, never try to manually install packages, let apt-get do all the work!

Pygame on Yocto

I've been trying to install the python library for making games, pygame, in my yocto image of linux for my raspberry pi 2. I have a python code of a game, I've run it in raspbian and it runs pretty slow, but it runs. Now in my image of linux I already have python but I have failed in installing the pygame library. Every time I tried to run the game it says "Error: import pygame", so clearly the problem is in the way I install the library.
I would appreciate any kind of help.
Did you check your PYTHONPATH is set ?
To set it, do:
export PYTHONPATH=/opt/ros/indigo/lib/python2.7/site-packages
You can add this line to your .profile or .bashrc

Categories

Resources