Skip to content

Commit

Permalink
adding tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasht committed Feb 28, 2022
1 parent b3059fa commit 2cb61e4
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
48 changes: 48 additions & 0 deletions 06-sistemaLinear/sistemaLinear_v11-emDev/teste/corFunc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
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',
'white']


def formatar(num, conta) -> dict:
formatado = list()


print(conta)
vars = get_vars(conta)
for i, v in enumerate(vars):
p1 = conta.find(v)
p2 = p1 +1
# print('i', 'v', 'p1 p2')
# print(i, v, p1, p2)
d = {
'nome':v+str(num),
'p1':p1,
'p2':p2,
'fg':cores[i]
}
formatado.append(d)

# mostrar

return formatado
if __name__ == '__main__':
conta2x2 = 'x2y=5\n3x-5y=4'
conta = conta2x2.split('\n')
print(conta)
formatado = list()
for i, c in enumerate(conta):
formatado.append(formatar(i, c))
print()
print(formatado)
31 changes: 31 additions & 0 deletions 06-sistemaLinear/sistemaLinear_v11-emDev/teste/cores copy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from tkinter import *
from sys import exit

conta2x2 = 'x2y=5\n3x-5y=4'
root = Tk()
text = Text(root, width=20, height=10)
text.config(font='arial 20 bold')
text.insert(END, conta2x2)
text.pack()

def q_evento(event):
exit()
root.bind('q', q_evento)

cs = conta2x2.split('\n')
print('cs', cs)
posicao = cs[0].find('y')
print('posicao:', posicao)

p1 = p2 = '1.'
p1 += str(posicao)
p2 += str(posicao+1)

print('p1:', p1, 'p2:', p2)


text.tag_add("y1", p1, p2)
text.tag_config("y1", background="black", foreground="green")

text.tag_config('1', foreground="green")
root.mainloop()

0 comments on commit 2cb61e4

Please sign in to comment.