-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
206 additions
and
8 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
cores = ['blue', | ||
'green', | ||
'yellow', | ||
'red', | ||
'cyan', | ||
'gray', | ||
'light green', | ||
'white'] | ||
|
||
|
||
def formatar(line, conta) -> list: | ||
line += 1 | ||
line = str(line) | ||
|
||
formatado = list() | ||
contador = 0 | ||
|
||
for i, c in enumerate(conta): | ||
if c.isalpha() and c != '=': | ||
|
||
p1 = i | ||
p2 = p1 + 1 | ||
|
||
p1 = str(p1) | ||
p2 = str(p2) | ||
|
||
nome = c+line+p1 | ||
|
||
if contador == len(cores): | ||
contador = 0 | ||
d = { | ||
'nome': nome, | ||
'p1': line+'.'+p1, | ||
'p2': line +'.'+p2, | ||
'fg': cores[contador] | ||
} | ||
formatado.append(d) | ||
contador += 1 | ||
|
||
return formatado | ||
|
||
|
||
if __name__ == '__main__': | ||
formatar(line=0, conta='33xcx8x=safsafsfasfasfsf') |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,10 @@ | |
# 2x-y+3z=10 | ||
# ''' | ||
|
||
conta1x1 = ''' | ||
2x=30 | ||
''' | ||
|
||
conta2x2 = ''' | ||
x 2y = 5 | ||
3x -5y = 4 | ||
|
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
63 changes: 63 additions & 0 deletions
63
06-sistemaLinear/sistemaLinear_v11-emDev/teste/testeCores/corFunc2.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
|
||
|
||
|
||
def get_vars(conta) -> list: | ||
vars = list() | ||
for c in conta: | ||
# print(c) | ||
if c.isalpha() or c == '=': | ||
vars.append(c) | ||
# print(c, vars) | ||
# print(vars) | ||
return vars | ||
|
||
cores = ['blue', | ||
'green', | ||
'yellow', | ||
'red', | ||
'cyan', | ||
'gray', | ||
'light green', | ||
'white'] | ||
|
||
def mostrar(n): | ||
for nn in n: | ||
print(nn) | ||
def formatar(line, conta) -> list: | ||
line += 1 | ||
line = str(line) | ||
|
||
print(conta) | ||
|
||
formatado = list() | ||
contador = 0 | ||
|
||
for i, c in enumerate(conta): | ||
if c.isalpha() and c != '=': | ||
|
||
p1 = i | ||
p2 = p1 + 1 | ||
|
||
p1 = str(p1) | ||
p2 = str(p2) | ||
# print('p1:', type(p1), p1) | ||
|
||
nome = c+line+p1 | ||
print(nome) | ||
if contador == len(cores): | ||
contador = 0 | ||
d = { | ||
'nome': nome, | ||
'p1': line+'.'+p1, | ||
'p2': line +'.'+p2, | ||
'fg': cores[contador] | ||
} | ||
formatado.append(d) | ||
contador += 1 | ||
# mostrar | ||
# print() | ||
# mostrar(formatado) | ||
|
||
return formatado | ||
if __name__ == '__main__': | ||
formatar(line=0, conta='33xcx8x=safsafsfasfasfsf') |
54 changes: 54 additions & 0 deletions
54
06-sistemaLinear/sistemaLinear_v11-emDev/teste/testeCores/cores5.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import imp | ||
from tkinter import * | ||
from sys import exit | ||
from corFunc import formatar | ||
|
||
conta2x2 = 'x2y=5\n3x-5y=4' | ||
class App(Tk): | ||
def __init__(self): | ||
super().__init__() | ||
|
||
self.text = Text(self, width=20, height=10) | ||
self.text.config(font='arial 20 bold') | ||
# self.text.insert(END, conta2x2) | ||
self.text.pack() | ||
self.text.config(background='black', foreground='white') | ||
|
||
# evento sair | ||
self.bind('q', self.q_evento) | ||
|
||
# | ||
self.bind('<KeyRelease>', self.event) | ||
|
||
|
||
def event(self, event): | ||
if self.text.get(1.0, END): | ||
self.put_color() | ||
def put_color(self): | ||
conta = self.text.get('1.0', END) | ||
print('c:', conta) | ||
conta = conta.split('\n') | ||
print(conta) | ||
formatado = list() | ||
|
||
# pegando informacoes | ||
|
||
for i, c in enumerate(conta): | ||
formatado.append(formatar(i, c)) | ||
print('f:', formatado) | ||
# colocando | ||
for f1 in formatado: | ||
for f in f1: | ||
self.text.tag_add(f['nome'], f['p1'], f['p2']) | ||
self.text.tag_config(f['nome'], foreground=f['fg']) | ||
|
||
def q_evento(self, event): | ||
exit() | ||
|
||
|
||
|
||
|
||
|
||
if __name__ == '__main__': | ||
root = App() | ||
root.mainloop() |