Essays.club - TCC, Modelos de monografias, Trabalhos de universidades, Ensaios, Bibliografias
Pesquisar

Conversor de Temperatura em Python

Por:   •  8/3/2018  •  1.144 Palavras (5 Páginas)  •  397 Visualizações

Página 1 de 5

...

self.Ecor.grid(row=4, column=1, sticky=(W, E))

self.Lcor = ttk.Label(self.parente, text=’PORTA’)

self.Lcor.grid(row=5, column=0, sticky=(W, E))

self.Ecor = ttk.Entry(self.parente, textvariable=self.porta, font=’helvetica 10’)

self.Ecor.grid(row=5, column=1, sticky=(W, E))

self.botãoPecas = ttk.Button(self.parente, text=’ATIVAR’, command=self.abrirarquivo)

self.botãoPecas.grid(row=6, column=1, sticky=(W))

self.botãoPecas = ttk.Button(self.parente, text=’DESATIVAR’, command=self.removeProxy)

self.botãoPecas.grid(row=7, column=1, sticky=(W))

self.botãoPecas = ttk.Button(self.parente, text=’APAGAR’, command=self.excluiArquivo)

self.botãoPecas.grid(row=8, column=1, sticky=(W))

self.botãoPecas = ttk.Button(self.parente, text=’HISTORICO’, command=self.consultaLog)

self.botãoPecas.grid(row=9, column=1, sticky=(W))

self.separador = ttk.Separator(self.parente,orient=’horizontal’).grid(row=11, columnspan=2, rowspan=3, sticky=(W,E))

self.caixaRetorno = ttk.Label(self.parente, textvariable=self.retorno).grid(row=14,column=0, columnspan=2,sticky=(W+E))

##############################################FIM DA CRIAÇÃO DA INTERFACE#########################################################3

def abrirarquivo(self, *args):

https = self.https.get()

http = self.http.get()

ftp = self.ftp.get()

porta = self.porta.get()

#self.configuracao(self.https, self.http, self.ftp, self.porta)

self.f = open(’/etc/apt/apt.conf.d/10proxy.conf’, ’w’)

self.f.write(’Acquire::HTTPS:%s\n Acquire::HTTP:%s\n Acquire::FTP:%s\nAcquire::PORTA:%s\n ’ % (https, http, ftp, porta))

self.l = open(’/etc/apt/apt.conf.d/logproxy.txt’,’a’) #GERA UM ARQUIVO DE LOG

self.l.write(’HTTPS:%s\nHTTP:%s\nFTP:%s\nPORTA:%s\n’ #ESCREVE NO LOG

’_____________________________________\n’ % (https, http, ftp, porta))

self.retorno.set(’CONFIGURAÇÃO DE PROXY CRIADA’)

self.l.close() #FECHA O ARQUIVO

self.f.close() #FECHA O ARQUIVO

def removeProxy(self, *args):

self.f = open(’/etc/apt/apt.conf.d/10proxy.conf’, ’w’)

self.f.write(’’) #SOBRESCRITA COLOCANDO VAZIO

self.f.close() #FECHA O ARQUIVO

self.retorno.set(’CONFIGURAÇÃO DE PROXY APAGADA’)

def excluiArquivo(self):

remove(’/etc/apt/apt.conf.d/10proxy.conf’) #remove apenas configuração deletando o arquivo q o contem

self.retorno.set(’ARQUIVO DE PROXY REMOVIDO’)

def consultaLog(self):

self.l = open(’/etc/apt/apt.conf.d/logproxy.txt’)

for self.linha in self.l:

print(self.linha)

self.l.close()

if __name__ == ’__main__’:

root = Tk() #INICIALIZAÇÃO DA JANELA

proxyGUI = PythonPY(root,width=80, height=50, padding=’3 3 12 12’)

proxyGUI.grid(sticky=(N, E, S, W))

root.title(’PROXER’) #NOME DO PROGRAMA

# foco e evento bind

root.bind(’<Return>’,

...

Baixar como  txt (5.9 Kb)   pdf (49.8 Kb)   docx (13.3 Kb)  
Continuar por mais 4 páginas »
Disponível apenas no Essays.club