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