Advertisement
pkaislan

CodigoApp

Aug 15th, 2017
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.07 KB | None | 0 0
  1. from tkinter import *
  2. from testeconexao import *
  3.  
  4.  
  5. class Aplicativo(Frame):
  6.  def __init__(self, master=None):
  7.    
  8.    Aplicativo = Tk()
  9.    Frame.__init__(self, master)
  10.    
  11.    
  12.      
  13.    imgtanio = PhotoImage(file ="C:\on_off.gif")
  14.    tanio = Button(Aplicativo, image = imgtanio)
  15.    tanio["command"] = lambda arg1 = b'n' : iniciarconexao.enviarDados(arg1)
  16.    tanio.imgtanio = imgtanio
  17.    tanio.pack(side = LEFT)
  18.  
  19.    
  20.    
  21.    botaodesligar = Button (Aplicativo, text = "Desligar o Carro" )
  22.    botaodesligar ["command"] =  lambda arg1 = b'o' : iniciarconexao.enviarDados(arg1)
  23.    botaodesligar.pack ()
  24.  
  25.    status = StringVar()
  26.    if iniciarconexao.receberDados == "e":
  27.        status.set  ("Chave Ligou")
  28.    else:
  29.        status.set ("Em Espera")    
  30.    
  31.        
  32.    caixaestado = Label(Aplicativo, textvariable = status)
  33.    caixaestado.pack (side="bottom")
  34.    
  35.    
  36.  
  37.    Frame.pack(self)
  38.  
  39.    
  40.  
  41.  
  42. iniciarconexao = Conexao()
  43.  
  44. app = Aplicativo()
  45. app.master.title("Tanio - A Car System")
  46. app.master.geometry("400x400+100+100")
  47.  
  48.  
  49.  
  50.  
  51. mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement