Commit 34839293 authored by Matheus Müller's avatar Matheus Müller
Browse files

Pasta Pezzi, melhorias no codigo e profundidade de cada elemento

parent fe22a210
0 0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
1.03722084368 0.214285714286
5.0 0
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.214285714286
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.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0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
# -*- coding: iso-8859-15 -*-
import Tkinter as tk
from PTE import *
from pylab import *
from numpy import zeros
import os
import tkFileDialog
##############################################################################
# Control variables and lists
Edict = dict()
Ebuttons = list()
Labentrys = list()
i=0
points = []
spline = 0
tag1 = "theline"
Econtrol = 0
##############################################################################
# PTE window
#PTE = tk.Tk()
#PTE.title('Periodic Table of Elements')
##############################################################################
# Element callback
def elem_callback(x, edict , ebutton, Labelmass, LabelZ, Labelname, Labelsymbol, Entrymass, EntryZ, Entryname, Entrysymbol):
PTable(edict[x] , ebutton[x], Labelmass, LabelZ, Labelname, Labelsymbol, Entrymass, EntryZ, Entryname, Entrysymbol)
def elem_callback(x, edict , ebutton):
global Labentrys
PTable(edict[x] , ebutton[x], Labentrys)
##############################################################################
# Element selection
def elem_select(i, button):
def elem_select(i, button, Labelmass, LabelZ, Labelname, Labelsymbol, LabelLS, Entrymass, EntryZ, Entryname, Entrysymbol,EntryLS):
global Econtrol, Edict, methodvar
global Econtrol, Edict, Labentrys
button[Econtrol]['relief']='raised'
Econtrol = i
button[i]['relief']='sunken'
Labelmass.configure(text = 'Mass - %f' %Edict[i]['mass'])
LabelZ.configure(text = 'Z - %f' %Edict[i]['Z'])
Labelname.configure(text = '%s' %Edict[i]['name'])
Labelsymbol.configure(text = 'Symbol - %s' %Edict[i]['symbol'])
LabelLS.configure(text = 'Line Shape α - %f' %Edict[i]['LineShape'])
Labentrys[0].configure(text = '%s' %Edict[i]['name'])
Labentrys[1].configure(text = 'Mass - %f' %Edict[i]['mass'])
Labentrys[2].configure(text = 'Z - %f' %Edict[i]['Z'])
Labentrys[3].configure(text = 'Symbol - %s' %Edict[i]['symbol'])
Labentrys[4].configure(text = 'Line Shape α - %f' %Edict[i]['LineShape'])
Labentrys[5].configure(text = 'Max Depht - %f' %Edict[i]['profundidademax'])
Entrymass.delete (0, len(Entrymass.get()))
Entryname.delete (0, len(Entryname.get()))
EntryZ.delete (0, len(EntryZ.get()))
Entrysymbol.delete (0, len(Entrysymbol.get()))
EntryLS.delete (0, len(EntryLS.get()))
for i in arange(6,12):
Labentrys[i].delete (0, len(Labentrys[i].get()))
Entrymass.insert(0, Edict[int(Econtrol)]['mass'])
Entryname.insert(0, Edict[int(Econtrol)]['name'])
EntryZ.insert(0, int(Edict[int(Econtrol)]['Z']))
Entrysymbol.insert(0, Edict[int(Econtrol)]['symbol'])
EntryLS.insert(0, Edict[int(Econtrol)]['LineShape'])
Labentrys[6].insert(0, Edict[int(Econtrol)]['name'])
Labentrys[7].insert(0, Edict[int(Econtrol)]['mass'])
Labentrys[8].insert(0, int(Edict[int(Econtrol)]['Z']))
Labentrys[9].insert(0, Edict[int(Econtrol)]['symbol'])
Labentrys[10].insert(0, Edict[int(Econtrol)]['LineShape'])
Labentrys[11].insert(0, Edict[int(Econtrol)]['profundidademax'])
##############################################################################
# Init
def ewin_build(window, xmax, xstep):
def ewin_build(window, EntryDstep):
##############################################################################
# Element addition
def create():
global i, Edict, Ebuttons
Edict[i] = dict(name = "Element X", symbol = "Hf", mass = 178.00, Z = 72, dist = zeros(int(xmax/xstep)), control = 0, LineShape = 200.)
Ebuttons.insert(i, tk.Button(Eframe, text=i, width=1, height=1, command = lambda i=i : elem_select(i,Ebuttons,Labelmass,LabelZ,Labelname,Labelsymbol,LabelLS,Entrymass,EntryZ,Entryname,Entrysymbol,EntryLS)))
Ebuttons[i].grid(column = ((len(Ebuttons)-1)%15), row = int(math.floor((len(Ebuttons)-1)/15)))
i=i+1
Edict[i] = dict(name = "New Element", symbol = "Hf", mass = 178.00, Z = 72, dist = zeros(int(10./float(EntryDstep.get()) )), LineShape = 200., profundidademax=10.)
Ebuttons.insert(i, tk.Button(Eframe, text=i, width=1, height=1, command = lambda i=i : elem_select(i,Ebuttons)) )
Ebuttons[i].grid(column = ((len(Ebuttons)-1)%14), row = int(math.floor((len(Ebuttons)-1)/14)))
i = i+1
##############################################################################
# Element deletion
def remove():
global i, Edict, Ebuttons, Econtrol
if i > 1:
i=i-1
i = i-1
del Edict[i]
Ebuttons[i].destroy()
del Ebuttons[i]
......@@ -103,20 +91,21 @@ def ewin_build(window, xmax, xstep):
##############################################################################
# Properties
global Econtrol, Edict
global Econtrol, Edict, Labentrys
def update(i):
Edict[i]['mass'] = float(Entrymass.get())
Labelmass.configure(text = 'Mass - %f' %Edict[i]['mass'])
Edict[i]['Z'] = float(EntryZ.get())
LabelZ.configure(text = 'Z - %f' %Edict[i]['Z'])
Edict[i]['name'] = str(Entryname.get())
Labelname.configure(text = '%s' %Edict[i]['name'])
Edict[i]['symbol'] = str(Entrysymbol.get())
Labelsymbol.configure(text = 'Symbol - %s' %Edict[i]['symbol'])
Edict[i]['LineShape'] = float(EntryLS.get())
LabelLS.configure(text = 'Line Shape α - %f' %Edict[i]['LineShape'])
Edict[i]['name'] = str(Labentrys[6].get())
Labentrys[0].configure(text = '%s' %Edict[i]['name'])
Edict[i]['mass'] = float(Labentrys[7].get())
Labentrys[1].configure(text = 'Mass - %f' %Edict[i]['mass'])
Edict[i]['Z'] = float(Labentrys[8].get())
Labentrys[2].configure(text = 'Z - %f' %Edict[i]['Z'])
Edict[i]['symbol'] = str(Labentrys[9].get())
Labentrys[3].configure(text = 'Symbol - %s' %Edict[i]['symbol'])
Edict[i]['LineShape'] = float