You are on page 1of 4

Unelte GUI pentru Python raspberry pi gui programming

Kivy
One of the more interesting projects, the liberal MIT-licensed Kivy is based on OpenGL ES 2
and includes native multi-touch for each platform and Android/iOS. Its an event-driven
framework based around a main loop, and is thus very suitable for game development. Your
application adds callbacks from the main loop at a scheduled frequency, or by one-off trigger.
The Kivy framework is very powerful for handling everything from widgets to animation, and
includes its own language for describing user interface and interactions.
If you want to create cross-platform graphical applications, or just need a very powerful crossplatform GUI, Kivy is highly recommended.

PyQt
Qt is a multi-licensed cross-platform framework written in C++. If your application is
completely open source, you can use Qt for free under the community license; otherwise youll
need a commercial license. Qt has been around for a long time and was owned by Nokia for a
while; its a very comprehensive library of tools and APIs, widely used in many industries, and
covers many platforms including mobile. If a gadget such as a SatNav has a GUI, theres a good
chance itll be Qt based.

PyGUI
Compared to Kivy and PyQt, PyGUI is considerably simpler and just for Unix, Macintosh and
Windows platforms. Developed by Dr. Greg Ewing at the University of Canterbury in New
Zealand, the MVC framework focuses on fitting into the Python ecosystem as easily as possible.
One of the platforms aims is to interpose as little code as possible between the Python
application and the platforms underlying GUI so the applications display always reflects the
native GUI of the platform. If youre after a simple and quick way to learn GUI, start with this
one.
Not listed there is TkInter, which is the most used Python toolkit. If you have Python running on
your system, you have TkInter. I decided not to use it though because the widgets have a very
dated look to them.
The other toolkit I considered was wxPython. The UI widgets have a modern feel, though they
not entirely native looking. Also plenty of documentation exists. However, I had some trouble
getting wxGlade running, which is a WYSIWYG GUI editor.

https://www.baldengineer.com/raspberry-pi-guitutorial.html
This lead me to Qt. PyQt is available as GPL or Commercial License while Qt
is available under LGPL or Commercial license dar free ca necomervial.
pure open source, then you might be happier with wxPython.
I wanted to use my laptop for development and then deploy the code to my Pi
when done.
sudo apt-get install python3 python3-pyqt5

On the PC you plan to develop from, download and install QtCreator. You can
download that from Qt,
I think getting python3, Qt5, and PyQt5 installed is the hardest part.
Making a GUI in QtCreator. Start a new project in QtCreator and select Desktop
Application.
http://pythonforengineers.com/your-first-gui-app-with-python-and-pyqt/

Python, generaliti
l folosesc pentr mdiul grafic, pentru camer, pentru c sunt multe exemple
pentru raspberry Pi

Using third-party tools, such as Py2exe or Pyinstaller,[30] Python code can be


packaged into stand-alone executable programs for some of the most popular
operating systems, so Python-based software can be distributed to, and used on,
those environments with no need to install a Python interpreter.

https://www.youtube.com/watch?v=OR5h0UnMcUE
wget O gpio_python_code.zip goo.gl/KiRxAN
unzip gpio_python_code.zip
sudo python program.py
gpio_python_code.zip

BCM = schema de numerotare

Cleanup = toi pinii input


Pentru intarzieri:
Import time
time.sleep(1)
Pentru buton:
Import os, se pot rula comenzi din OS
while True:
GPIO.setup(10,GPIO.IN)

os.system(date)

= trimite comanda

optiune=input(Introdu operatia: )
while n<11:
n shell ls l mi d date despre fiiere
Interfa cu un senzor 1-Wire https://www.youtube.com/watch?v=S2v1VNgHnvI
Citire fiier https://www.youtube.com/watch?v=m5JwOWYmLK8
if a==1 and b==3

! Python programming for Raspberry Pi Blum.pdf


La literalele sir se pot folosi si si
>>> print ("This example protects the output's single quote.")
>>> print ('I said, "I need to protect my quotation!" and did so.')
Pot sa include si trecerea la rand nou
Using Triple Quotes
>>> print ("""This is line one.
... This is line two.
... This is line three.""")
>>> print ("""Raz said, "I didn't know about triple quotes!" and laughed.""")
Accept secvene Escape.
\u UNICODE
nu are variabile, ci numai obiecte
Conteaz litera mare / mic
Tipuri de dat: float, int, long, str
Citire: var = input (mesaj)
int(string)

Python GUI Tkinter


Tkinter is a Python binding to the Tk GUI toolkit. It is the standard Python interface to the Tk
GUI toolkit,[1] and is Python's de facto standard GUI.[2] Tkinter is included with the standard
Microsoft Windows and Mac OS X install of Python.
The name Tkinter comes from Tk interface. Tkinter was written by Fredrik Lundh.

popular GUI library alternatives available, such as wxPython, PyQt (PySide),


Pygame, Pyglet, and PyGTK.

Instalare Open CV 3
http://www.pyimagesearch.com/2016/04/18/install-guide-raspberry-pi-3-raspbianjessie-opencv-3/
sudo apt-get update
sudo apt-get upgrade
We then need to install some developer tools, including CMake, which helps us
configure the OpenCV build process:
sudo apt-get install build-essential cmake pkg-config
sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev

sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev


$ sudo apt-get install libxvidcore-dev libx264-dev
sudo apt-get install libgtk2.0-dev
sudo apt-get install libatlas-base-dev gfortran

cd ~
$ wget -O opencv.zip https://github.com/Itseez/opencv/archive/3.1.0.zip
$ unzip opencv.zip
wget https://bootstrap.pypa.io/get-pip.py
$ sudo python get-pip.py
sudo pip install virtualenv virtualenvwrapper
$ sudo rm -rf ~/.cache/pip
# virtualenv and virtualenvwrapper
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
$ source ~/.profile
mkvirtualenv cv -p python2
mkvirtualenv cv -p python3

source ~/.profile
$ workon cv
pip install numpy