Created
April 22, 2013 04:10
-
-
Save muZk/5432405 to your computer and use it in GitHub Desktop.
GUI en paralelo con un Loop true
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import Tkinter | |
import tkFileDialog | |
import multiprocessing | |
import time | |
import thread | |
class GUI: | |
def __init__(self): | |
self.window = Tkinter.Tk() | |
## Textbox para el numero de telefono | |
Tkinter.Label(self.window, text="Numero telefono").pack() | |
Tkinter.Entry(self.window).pack() | |
## Textbox para los mensajes de texto | |
Tkinter.Label(self.window, text="Mensaje de texto").pack() | |
Tkinter.Entry(self.window).pack() | |
# Botón para llamar | |
Tkinter.Button(self.window, text="LLamar a numero", command=self.llamar).pack() | |
# Boton para cortar llamada | |
Tkinter.Button(self.window, text="Terminar llamada", command=self.cortar).pack() | |
# Botón para enviar mensaje | |
Tkinter.Button(self.window, text="Enviar mensaje", command=self.enviar_mensaje).pack() | |
# Botón para ver contactos | |
Tkinter.Button(self.window, text="Ver contactos", command=self.ver_contactos).pack() | |
# Botón para historial de llamadas | |
Tkinter.Button(self.window, text="Ver historial llamadas", command=self.ver_contactos).pack() | |
# Ver mensajes | |
Tkinter.Button(self.window, text="Ver mensajes", command=self.ver_contactos).pack() | |
# Ver procesos | |
Tkinter.Button(self.window, text="Ver procesos", command=self.ver_contactos).pack() | |
# Ejecutar proceso | |
Tkinter.Button(self.window, text="Ejecutar proceso", command=self.ver_contactos).pack() | |
self.window.mainloop() # ejecuta la ventana | |
def llamar(self): | |
print 'Llamando' | |
def cortar(self): | |
print 'Cortando llamada' | |
def enviar_mensaje(self): | |
print 'Enviando mensaje de texto' | |
def ver_contactos(self): | |
print 'Viendo contactos' | |
def historial_llamadas(self): | |
print 'Historial llamadas' | |
def ver_mensajes(self): | |
print 'Ver mensajes' | |
def ver_procesos(self): | |
print 'Ver Procesos' | |
def ejecutar_proceso(self): | |
print 'Ejecutar proceso' | |
def run(): | |
GUI() | |
if __name__ == '__main__': | |
thread.start_new_thread(run, ()) # iniciamos la GUI en un thread aparte | |
while True: # ejecutamos el main loop en el thread princiap... aqui podria el run del SO | |
print 'loop...' | |
time.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment