-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgerador.py
More file actions
119 lines (103 loc) · 4.05 KB
/
Copy pathgerador.py
File metadata and controls
119 lines (103 loc) · 4.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
from tkinter import *
import clipboard
#O.S, utilizar a do copy da area de transferência
class Aplicacao:
def __init__(self, master=None):
self.telamaster = master
self.fontePadrao = ("Arial", "10", 'bold')
self.primeiroContainer = Frame(master)
self.primeiroContainer['bg'] = '#696969'
self.primeiroContainer.pack(side=LEFT)
# botão gerar
self.gerar = Button(self.primeiroContainer)
self.gerar["text"] = "Gerar"
self.gerar["font"] = ("Calibri", "12", "bold")
self.gerar["width"] = 20
self.gerar['bg'] = '#00cc4c'
self.gerar['fg'] = '#191919'
self.gerar["command"] = self.capturaTexto
self.gerar.pack(side=TOP)
#botão apagar
self.apagar = Button(self.primeiroContainer)
self.apagar["text"] = "Apagar"
self.apagar["font"] = ("Calibri", "12", "bold")
self.apagar["width"] = 20
self.apagar['bg'] = '#e61919'
self.apagar['fg'] = '#191919'
self.apagar["command"] = self.apagaTexto
self.apagar.pack(side=TOP)
#botão copiar
self.copiar = Button(self.primeiroContainer)
self.copiar["text"] = "Copiar"
self.copiar["font"] = ("Calibri", "12", "bold")
self.copiar["width"] = 20
self.copiar['bg'] = '#ffdf00'
self.copiar['fg'] = '#191919'
self.copiar["command"] = self.copiaTexto
self.copiar.pack(side=TOP)
#botão sair
self.sair = Button(self.primeiroContainer)
self.sair["text"] = "Sair"
self.sair["font"] = ("Calibri", "12", "bold")
self.sair["width"] = 20
self.sair['bg'] = '#000'
self.sair['fg'] = '#fff'
self.sair["command"] = self.sair_exit
self.sair.pack(side=TOP)
self.text2 = Text(master, height=32, width=60)
self.scroll = Scrollbar(master, command=self.text2.yview)
self.text2.configure(yscrollcommand=self.scroll.set)
self.text2.tag_configure('color', foreground='#000')
self.text2.insert(END, '#Feito por Igor Ramos de Oliveira, 03-09-2018.\n')
self.quote = '#Digite os atributos separados por enter\n'
self.text2.insert(END, self.quote, 'color')
self.text2.pack(side=LEFT)
self.scroll.pack(side=RIGHT, fill=Y)
def capturaTexto(self):
#self.apagaTexto()
texto = self.text2.get(3.0,END)
#tratando a string de leitura
texto=texto.strip()
texto=texto.replace("\n"," ")
texto=texto.split(" ")
#fim do tratamento
#inicio codigo gerador
mae=''
for i in range(len(texto)):
if len(texto[i])>0:
gete = ''
sete = ''
gete = "\n@property\ndef " + texto[i] + "(self):\n\treturn self.__" + texto[i]
sete = "\n@"+texto[i]+".setter\ndef " + texto[i] + "(self,valor):\n\tself.__" + texto[i] + " = valor"
mae=mae+(gete+sete)
else:
pass
#fim gerador
self.apagaTexto2()
self.text2.insert(END,"#Propertys Geradas com Sucesso! por Igor Ramos de Oliveira: #2018-09/03\n\n")
self.text2.insert(END,mae)
def apagaTexto(self):
self.text2.delete(1.0, END)
self.text2.insert(END, '#Feito por Igor Ramos de Oliveira, 03-09-2018.\n')
self.quote = '#Digite os atributos separados por enter\n'
self.text2.insert(END, self.quote, 'color')
def apagaTexto2(self):
self.text2.delete(1.0, END)
def copiaTexto(self):
texto = self.text2.get(1.0, END)
clipboard.copy(texto)
def sair_exit(self):
self.telamaster.destroy()
def centralizar(janela):
x = (janela.winfo_screenwidth() - janela.winfo_reqwidth()) / 6
y = (janela.winfo_screenheight() - janela.winfo_reqheight()) / 6
janela.geometry("+%d+%d" % (x, y))
root = Tk()
root.title("Gerador Get Set versão : 1.0")
root.resizable(0,0)
root['bg']='#545454'
centralizar(root)
Aplicacao(root)
root.mainloop()
#aqui é fim do código
#fim :)