Beruflich Dokumente
Kultur Dokumente
1 de noviembre de 2010
Introducción
Desarrollo de Software
2 of 30
Introducción
Desarrollo de Software
Diseño.
2 of 30
Introducción
Desarrollo de Software
Diseño.
Implementación.
2 of 30
Introducción
Desarrollo de Software
Diseño.
Implementación.
A veces puede ser una pesadilla!
2 of 30
Introducción
Desarrollo de Software
Diseño.
Implementación.
A veces puede ser una pesadilla!
...entonces Qt viene en nuestro rescate.
2 of 30
Introducción
Desarrollo de Software
Diseño.
Implementación.
A veces puede ser una pesadilla!
...entonces Qt viene en nuestro rescate.
y todo es mejor aún con Python.
2 of 30
Introducción
¿Qué es Python?
3 of 30
Introducción
¿Qué es Python?
3 of 30
Introducción
¿Qué es Python?
3 of 30
Introducción
¿Qué es Python?
3 of 30
Introducción
¿Qué es Python?
3 of 30
Introducción
¿Qué es Python?
3 of 30
Introducción
¿Qué es Python?
3 of 30
Introducción
¿Qué es Qt?
Biblioteca multiplataforma.
4 of 30
Introducción
¿Qué es Qt?
Biblioteca multiplataforma.
Es un framework desarrollado en C++.
4 of 30
Introducción
¿Qué es Qt?
Biblioteca multiplataforma.
Es un framework desarrollado en C++.
Permite desarrollo de UI, DB, XML, WebKit, Multimedia,
Networking, OpenGL, scripting, etc.
4 of 30
Introducción
¿Qué es Qt?
Biblioteca multiplataforma.
Es un framework desarrollado en C++.
Permite desarrollo de UI, DB, XML, WebKit, Multimedia,
Networking, OpenGL, scripting, etc.
NO es sólo una biblioteca gráfica. (como otras.......
4 of 30
Introducción
¿Qué es Qt?
Biblioteca multiplataforma.
Es un framework desarrollado en C++.
Permite desarrollo de UI, DB, XML, WebKit, Multimedia,
Networking, OpenGL, scripting, etc.
NO es sólo una biblioteca gráfica. (como otras.......
..................GTK)
4 of 30
Introducción
Tenemos Qt con distintos sabores
5 of 30
Introducción
¿Donde está Qt?
VIDEO!
6 of 30
Introducción
Herramientas de Ayuda
Qt-Creator
7 of 30
Introducción
Herramientas de Ayuda
Designer
8 of 30
Introducción
Hello World
import s y s
from PyQt4 . QtGui import QLabel , Q A p p l i c a t i o n
app = Q A p p l i c a t i o n ( s y s . a r g v )
l a b e l = QLabel ( ” H e l l o World ” )
l a b e l . show ( )
s y s . e x i t ( app . e x e c ( ) )
9 of 30
Introducción
Simple
import s y s
from PyQt4 import QtGui
app = QtGui . Q A p p l i c a t i o n ( s y s . a r g v )
w i d g e t = QtGui . QWidget ( )
widget . r e s i z e (250 , 150)
widget . setWindowTitle ( ’ simple ’ )
w i d g e t . show ( )
s y s . e x i t ( app . e x e c ( ) )
10 of 30
Conceptos
OO
11 of 30
Conceptos
Jerarquı́a
Su estructura es modular.
> 300 clases.
> 6000 métodos.
En los cuales podemos encontrar:
QtCore
QtGui
QtSvg
QtSQL
...
12 of 30
Conceptos
Comportamiento
13 of 30
Conceptos
Comportamiento
14 of 30
Conceptos
Comportamiento
15 of 30
Ejemplos
Lineas
import s y s
from PyQt4 i m p o r t QtGui
from l i n e a s i m p o r t ∗
16 of 30
Ejemplos
Listas
import s y s
from PyQt4 i m p o r t QtGui
from l i s t a s i m p o r t ∗
def addButtonPressed ( s e l f ) :
text = s e l f . ui . l i n e . text ()
s e l f . l i n e a s . append ( t e x t )
s e l f . u i . l i s t . addItem ( t e x t )
s e l f . ui . l i n e . setText ( ’ ’ )
def delButtonPressed ( s e l f ) :
item = s e l f . u i . l i s t . c u r r e n t I t e m ()
t e x t = item . t e x t ()
j =0
for i in s e l f . lineas :
i f i == t e x t :
del s e l f . l i n e a s [ j ]
17 of 30 j = j + 1
s e l f . ui . l i s t . clear ()
Ejemplos
Seleccion
import s y s
from PyQt4 i m p o r t QtCore , QtGui
from s e l e c c i o n i m p o r t ∗
def f i l l ( self ):
s e l f . nombres = [ ’ C r i s t i a n ’ ,\
’ I g n a c i o ’ ,\
’ G a b r i e l ’ ,\
’ C h r i s t o p h e r ’ ,\
’ A r n a l d o ’ ,\
’ J a i m e ’ ,\
’ S e r g i o ’ ,\
’ Yonathan ’ ]
for i in s e l f . nombres :
s e l f . u i . comboBox . a d d I t e m ( i )
s e l f . p e r s o n a s = [ ’ Yonathan Dossow ’ ,\
’ J a i m e P e l d o z a ’ ,\
’ J a i m e Oyarzun ’ ,\
18 of 30 ’ A r n a l d o G a r a t ’ ,\
’ S e r g i o M o r a l e s ’ ,\
Ejemplos
Fuentes
import s y s
from PyQt4 i m p o r t QtGui
from f o n t s i m p o r t ∗
def changeFont ( s e l f ) :
s e l f . u i . f o n t . s e t F o n t ( s e l f . u i . fontComboBox . c u r r e n t F o n t ( ) )
if name == ” m a i n ” :
app = QtGui . Q A p p l i c a t i o n ( s y s . a r g v )
myapp = myGUI ( )
myapp . show ( )
s y s . e x i t ( app . e x e c ( ) )
19 of 30
Ejemplos
Calendario
import s y s
from PyQt4 i m p o r t QtGui
from c a l e n d a r i m p o r t ∗
def changeDate ( s e l f ) :
s e l f . ui . l i n e E d i t . setText ( s e l f . ui . calendarWidget . selectedDate ( ) . toString ())
if name == ” m a i n ” :
app = QtGui . Q A p p l i c a t i o n ( s y s . a r g v )
myapp = myGUI ( )
myapp . show ( )
s y s . e x i t ( app . e x e c ( ) )
20 of 30
Ejemplos
Tabs
import s y s
from PyQt4 i m p o r t QtGui
from t a b s i m p o r t ∗
if name == ” m a i n ” :
app = QtGui . Q A p p l i c a t i o n ( s y s . a r g v )
myapp = myGUI ( )
myapp . show ( )
s y s . e x i t ( app . e x e c ( ) )
21 of 30
Ejemplos
Formulario
i m p o r t os , s y s
from PyQt4 i m p o r t QtCore , QtGui , Qt
from f o r m u l a r i o i m p o r t ∗
def changeRadioMale ( s e l f ) :
s e l f . s e x = ”Hombre”
def changeRadioFemale ( s e l f ) :
22 of 30 s e l f . s e x = ” Mujer ”
Ejemplos
Menu
i m p o r t os , s y s
from PyQt4 i m p o r t QtCore , QtGui , Qt
from menu i m p o r t ∗
23 of 30
Ejemplos
Drag and Drop
import s y s
from PyQt4 i m p o r t QtGui
c l a s s DragDrop ( QtGui . Q D i a l o g ) :
def init ( s e l f , p a r e n t=None ) :
QtGui . Q D i a l o g . init ( self , parent )
s e l f . r e s i z e (180 , 60)
e d i t = QtGui . Q L i n e E d i t ( ’ ’ , s e l f )
e d i t . s e t D r a g E n a b l e d ( True )
e d i t . move ( 2 0 , 2 0 )
s c r e e n = QtGui . QDesktopWidget ( ) . s c r e e n G e o m e t r y ( )
s i z e = s e l f . geometry ( )
if name == ” m a i n ” :
app = QtGui . Q A p p l i c a t i o n ( s y s . a r g v )
i c o n = DragDrop ( )
i c o n . show ( )
s y s . e x i t ( app . e x e c ( ) )
24 of 30
Ejemplos
Multimedia - Audio
import s y s
from PyQt4 i m p o r t QtGui
from PyQt4 . phonon i m p o r t Phonon
app = QtGui . Q A p p l i c a t i o n ( s y s . a r g v )
u r l=” A i r b e a t P r o j e c t −A i r b e a t O n e . mp3”
w = QtGui . QWidget ( )
a u d i o = Phonon . c r e a t e P l a y e r ( Phonon . M u s i c C a t e g o r y ,
Phonon . M e d i a S o u r c e ( u r l ) )
w. setMinimumSize (100 ,100)
w . show ( )
audio . play ()
s y s . e x i t ( app . e x e c ( ) )
25 of 30
Ejemplos
Multimedia - Video
import s y s
from PyQt4 i m p o r t QtGui
from PyQt4 . phonon i m p o r t Phonon
app = QtGui . Q A p p l i c a t i o n ( s y s . a r g v )
u r l=” q t . f l v ”
w = QtGui . QWidget ( )
p l a y e r = Phonon . V i d e o P l a y e r ( Phonon . V i d e o C a t e g o r y , w)
p l a y e r . l o a d ( Phonon . M e d i a S o u r c e ( u r l ) )
w. setMinimumSize (400 ,400)
t o p L a y o u t = QtGui . QVBoxLayout (w)
t o p L a y o u t . addWidget ( p l a y e r )
w. setLayout ( topLayout )
w . show ( )
player . play ()
s y s . e x i t ( app . e x e c ( ) )
26 of 30
Ejemplos
openWall
Veamos el codigo!
27 of 30
Ejemplos
µBot Interface
Veamos el codigo!
28 of 30
Conclusiones
29 of 30
¿Preguntas?
30 of 30