Commit 609091a0 authored by Matheus Müller's avatar Matheus Müller

Link entre interface e cálculos numéricos usando Tkinter

parent 72c9a113
from numpy import *
SLOT = dict(ELEa = dict(name = "New", symbol = "-", mass = 0.00, Z = 0, dist = zeros((1000), float), control = 0),
ELEb = dict(name = "New", symbol = "-", mass = 0.00, Z = 0, dist = zeros((1000), float), control = 0),
ELEc = dict(name = "New", symbol = "-", mass = 0.00, Z = 0, dist = zeros((1000), float), control = 0),
ELEd = dict(name = "New", symbol = "-", mass = 0.00, Z = 0, dist = zeros((1000), float), control = 0),
ELEe = dict(name = "New", symbol = "-", mass = 0.00, Z = 0, dist = zeros((1000), float), control = 0),
ELEf = dict(name = "New", symbol = "-", mass = 0.00, Z = 0, dist = zeros((1000), float), control = 0),
ELEg = dict(name = "New", symbol = "-", mass = 0.00, Z = 0, dist = zeros((1000), float), control = 0),
ELEh = dict(name = "New", symbol = "-", mass = 0.00, Z = 0, dist = zeros((1000), float), control = 0),
ELEi = dict(name = "New", symbol = "-", mass = 0.00, Z = 0, dist = zeros((1000), float), control = 0),
ELEj = dict(name = "New", symbol = "-", mass = 0.00, Z = 0, dist = zeros((1000), float), control = 0),
ELEk = dict(name = "New", symbol = "-", mass = 0.00, Z = 0, dist = zeros((1000), float), control = 0),
ELEl = dict(name = "New", symbol = "-", mass = 0.00, Z = 0, dist = zeros((1000), float), control = 0),
ELEm = dict(name = "New", symbol = "-", mass = 0.00, Z = 0, dist = zeros((1000), float), control = 0),
ELEn = dict(name = "New", symbol = "-", mass = 0.00, Z = 0, dist = zeros((1000), float), control = 0),
ELEo = dict(name = "New", symbol = "-", mass = 0.00, Z = 0, dist = zeros((1000), float), control = 0))
import Tkinter as tk
from Edict import *
from PTE import *
from Eprop import *
def elemw(elewindow):
####################################################
# Button building on received frame
co1 = lambda: PTable(SLOT['ELEa'], bu1)
co1a = lambda: atomsubmenu(SLOT['ELEa'], bu1)
bu1 = tk.Menubutton(elewindow, text=SLOT['ELEa']['symbol'], width=3, height=1, relief='raised')
m1 = tk.Menu(bu1)
bu1.config(menu=m1)
m1.add_command(label='Choose by PTE', command=co1)
m1.add_command(label='Properties', command=co1a)
co2 = lambda: PTable(SLOT['ELEb'], bu2)
co2a = lambda: atomsubmenu(SLOT['ELEb'], bu2)
bu2 = tk.Menubutton(elewindow, text=SLOT['ELEb']['symbol'], width=3, height=1, relief='raised')
m2 = tk.Menu(bu2)
bu2.config(menu=m2)
m2.add_command(label='Choose by PTE', command=co2)
m2.add_command(label='Properties', command=co2a)
co3 = lambda: PTable(SLOT['ELEc'], bu3)
co3a = lambda: atomsubmenu(SLOT['ELEc'], bu3)
bu3 = tk.Menubutton(elewindow, text=SLOT['ELEc']['symbol'], width=3, height=1, relief='raised')
m3 = tk.Menu(bu3)
bu3.config(menu=m3)
m3.add_command(label='Choose by PTE', command=co3)
m3.add_command(label='Properties', command=co3a)
co4 = lambda: PTable(SLOT['ELEd'], bu4)
co4a = lambda: atomsubmenu(SLOT['ELEd'], bu4)
bu4 = tk.Menubutton(elewindow, text=SLOT['ELEd']['symbol'], width=3, height=1, relief='raised')
m4 = tk.Menu(bu4)
bu4.config(menu=m4)
m4.add_command(label='Choose by PTE', command=co4)
m4.add_command(label='Properties', command=co4a)
co5 = lambda: PTable(SLOT['ELEe'], bu5)
co5a = lambda: atomsubmenu(SLOT['ELEe'], bu5)
bu5 = tk.Menubutton(elewindow, text=SLOT['ELEe']['symbol'], width=3, height=1, relief='raised')
m5 = tk.Menu(bu5)
bu5.config(menu=m5)
m5.add_command(label='Choose by PTE', command=co5)
m5.add_command(label='Properties', command=co5a)
co6 = lambda: PTable(SLOT['ELEf'], bu6)
co6a = lambda: atomsubmenu(SLOT['ELEf'], bu6)
bu6 = tk.Menubutton(elewindow, text=SLOT['ELEf']['symbol'], width=3, height=1, relief='raised')
m6 = tk.Menu(bu6)
bu6.config(menu=m6)
m6.add_command(label='Choose by PTE', command=co6)
m6.add_command(label='Properties', command=co6a)
co7 = lambda: PTable(SLOT['ELEg'], bu7)
co7a = lambda: atomsubmenu(SLOT['ELEg'], bu7)
bu7 = tk.Menubutton(elewindow, text=SLOT['ELEg']['symbol'], width=3, height=1, relief='raised')
m7 = tk.Menu(bu7)
bu7.config(menu=m7)
m7.add_command(label='Choose by PTE', command=co7)
m7.add_command(label='Properties', command=co7a)
co8 = lambda: PTable(SLOT['ELEh'], bu8)
co8a = lambda: atomsubmenu(SLOT['ELEh'], bu8)
bu8 = tk.Menubutton(elewindow, text=SLOT['ELEh']['symbol'], width=3, height=1, relief='raised')
m8 = tk.Menu(bu8)
bu8.config(menu=m8)
m8.add_command(label='Choose by PTE', command=co8)
m8.add_command(label='Properties', command=co8a)
co9 = lambda: PTable(SLOT['ELEi'], bu9)
co9a = lambda: atomsubmenu(SLOT['ELEi'], bu9)
bu9 = tk.Menubutton(elewindow, text=SLOT['ELEi']['symbol'], width=3, height=1, relief='raised')
m9 = tk.Menu(bu9)
bu9.config(menu=m9)
m9.add_command(label='Choose by PTE', command=co9)
m9.add_command(label='Properties', command=co9a)
co10 = lambda: PTable(SLOT['ELEj'], bu10)
co10a = lambda: atomsubmenu(SLOT['ELEj'], bu10)
bu10= tk.Menubutton(elewindow, text=SLOT['ELEj']['symbol'], width=3, height=1, relief='raised')
m10 = tk.Menu(bu10)
bu10.config(menu=m10)
m10.add_command(label='Choose by PTE', command=co10)
m10.add_command(label='Properties', command=co10a)
co11 = lambda: PTable(SLOT['ELEk'], bu11)
co11a = lambda: atomsubmenu(SLOT['ELEk'], bu11)
bu11 = tk.Menubutton(elewindow, text=SLOT['ELEk']['symbol'], width=3, height=1, relief='raised')
m11 = tk.Menu(bu11)
bu11.config(menu=m11)
m11.add_command(label='Choose by PTE', command=co11)
m11.add_command(label='Properties', command=co11a)
co12 = lambda: PTable(SLOT['ELEl'], bu12)
co12a = lambda: atomsubmenu(SLOT['ELEl'], bu12)
bu12 = tk.Menubutton(elewindow, text=SLOT['ELEl']['symbol'], width=3, height=1, relief='raised')
m12 = tk.Menu(bu12)
bu12.config(menu=m12)
m12.add_command(label='Choose by PTE', command=co12)
m12.add_command(label='Properties', command=co12a)
co13 = lambda: PTable(SLOT['ELEm'], bu13)
co13a = lambda: atomsubmenu(SLOT['ELEm'], bu13)
bu13 = tk.Menubutton(elewindow, text=SLOT['ELEm']['symbol'], width=3, height=1, relief='raised')
m13 = tk.Menu(bu13)
bu13.config(menu=m13)
m13.add_command(label='Choose by PTE', command=co13)
m13.add_command(label='Properties', command=co13a)
co14 = lambda: PTable(SLOT['ELEn'], bu14)
co14a = lambda: atomsubmenu(SLOT['ELEn'], bu14)
bu14 = tk.Menubutton(elewindow, text=SLOT['ELEn']['symbol'], width=3, height=1, relief='raised')
m14 = tk.Menu(bu14)
bu14.config(menu=m14)
m14.add_command(label='Choose by PTE', command=co14)
m14.add_command(label='Properties', command=co14a)
co15 = lambda: PTable(SLOT['ELEo'], bu15)
co15a = lambda: atomsubmenu(SLOT['ELEo'], bu15)
bu15 = tk.Menubutton(elewindow, text=SLOT['ELEo']['symbol'], width=3, height=1, relief='raised')
m15 = tk.Menu(bu15)
bu15.config(menu=m15)
m15.add_command(label='Choose by PTE', command=co15)
m15.add_command(label='Properties', command=co15a)
####################################################
bu1.grid(row=0, column=0, padx=1, pady=1)
bu2.grid(row=0, column=1, padx=1, pady=1)
bu3.grid(row=0, column=2, padx=1, pady=1)
bu4.grid(row=0, column=3, padx=1, pady=1)
bu5.grid(row=0, column=4, padx=1, pady=1)
bu6.grid(row=1, column=0, padx=1, pady=1)
bu7.grid(row=1, column=1, padx=1, pady=1)
bu8.grid(row=1, column=2, padx=1, pady=1)
bu9.grid(row=1, column=3, padx=1, pady=1)
bu10.grid(row=1, column=4, padx=1, pady=1)
bu11.grid(row=2, column=0, padx=1, pady=1)
bu12.grid(row=2, column=1, padx=1, pady=1)
bu13.grid(row=2, column=2, padx=1, pady=1)
bu14.grid(row=2, column=3, padx=1, pady=1)
bu15.grid(row=2, column=4, padx=1, pady=1)
####################################################
import Tkinter as tk
from Edict import *
from pylab import *
xsum=0.
xdep=0.
def atomsubmenu(elem, but):
sub = tk.Tk()
sub.title(elem['name'])
propbutton = tk.Menubutton(sub, width=20, text='Edit properties')
edit = tk.Menu(propbutton)
propbutton.config(menu=edit)
distbutton = tk.Menubutton(sub, width=20, text='Edit distribution')
editdist = tk.Menu(distbutton)
distbutton.config(menu=editdist)
def cmdadd():
if elem['control']==0:
elem['control']=1
but['text'] = elem['symbol']
but['relief'] = 'sunken'
addremove['text']='Remove element'
else:
elem['control']=0
but['relief'] = 'raised'
addremove['text']='Add element'
addremove = tk.Button(sub, width=16, bg='white', command=cmdadd, relief='raised', bd=4)
if elem['control']==0:
addremove['text']='Add element'
else:
addremove['text']='Remove element'
addremove.pack(side='bottom')
L1 = tk.Label(sub, text = 'Mass - %f' %elem['mass'])
L1.pack()
L2 = tk.Label(sub, text = 'Z - %d' %elem['Z'])
L2.pack()
L3 = tk.Label(sub, text = 'Symbol - %s' %elem['symbol'])
L3.pack()
def cmdmass():
submass = tk.Tk()
submass.title('%s - Mass' %elem['name'])
def modmass():
elem['mass'] = float(E1.get())
submass.destroy()
L1.configure(text = 'Mass - %f' %elem['mass'])
E1 = tk.Entry(submass, bd =2, width=20)
E1.pack()
B1 = tk.Button(submass, text ='Modify', command=modmass, width=18)
B1.pack()
E1.focus_force()
F1 = tk.Frame(submass, width=300)
F1.pack()
submass.mainloop()
def cmdz():
subz = tk.Tk()
subz.title('%s - Z' %elem['name'])
def modz():
elem['Z'] = int(E2.get(), 10)
subz.destroy()
L2.configure(text = 'Z - %d' %elem['Z'])
E2 = tk.Entry(subz, bd =2, width=20)
E2.pack()
B2 = tk.Button(subz, text ='Modify', command=modz, width=18)
B2.pack()
E2.focus_force()
subz.mainloop()
def cmdname():
subname = tk.Tk()
subname.title('%s - Name' %elem['name'])
def modname():
elem['name'] = E3.get()
subname.destroy()
sub.title(elem['name'])
E3 = tk.Entry(subname, bd =2, width=20)
E3.pack()
B3 = tk.Button(subname, text ='Modify', command=modname, width=18)
B3.pack()
E3.focus_force()
subname.mainloop()
def cmdsymbol():
subsymbol = tk.Tk()
subsymbol.title('Symbol - %s' %elem['symbol'])
def modsymbol():
elem['symbol'] = E4.get()
subsymbol.destroy()
L3.configure(text = 'Symbol - %s' %elem['symbol'])
but['text'] = elem['symbol']
E4 = tk.Entry(subsymbol, bd =2, width=20)
E4.pack()
B4 = tk.Button(subsymbol, text ='Modify', command=modsymbol, width=18)
B4.pack()
E4.focus_force()
subsymbol.mainloop()
def cmddraw():
print elem['mass']
def cmdnume():
global xsum
xsum = 0
subnume = tk.Tk()
subnume.title('%s - Distribution' %elem['name'])
subnume.minsize(295,95)
subnume.resizable(width='false', height='false')
F6 = tk.Frame(subnume, width=100)
F6b = tk.Frame(subnume, width=100)
F6.grid(column=0, row=0, sticky='w')
F6b.grid(column=0, row=0, sticky='e')
def modnume():
global xsum
global xdep
xdep=float(E6.get())
L6.configure(text='Current depth = %fnm' %(xdep+xsum/100))
for j in range(int(xsum), int(xsum + xdep*100)):
if j > 999:
print "Reached maximum depth"
break
else:
elem['dist'][j]=float(E6b.get())
xsum+=xdep*100
E6.delete(0, 'end')
E6.insert(0, 0)
E6 = tk.Entry(F6b, bd =2, width=10)
E6.pack()
E6b = tk.Entry(F6b, bd =2, width=10)
E6b.pack()
B6 = tk.Button(subnume, text ='Add depth/concentration', command=modnume, width=33)
B6.grid(column=0, row=2)
E6.focus_force()
L6 = tk.Label(subnume, text = 'Current depth = %f' %xdep)
L6.grid(column=0, row=1)
L6b = tk.Label(F6, text = 'Depth Amount', width=25)
L6b.pack()
L6c = tk.Label(F6, text = 'Concentration factor (0 to 1)', width=25)
L6c.pack()
subnume.mainloop()
def cmdspecial():
plot (elem['dist'])
show()
edit.add_command(label='Mass', command=cmdmass)
edit.add_command(label='Name', command=cmdname)
edit.add_command(label='Z', command=cmdz)
edit.add_command(label='Symbol', command=cmdsymbol)
editdist.add_command(label='Drawing', command=cmddraw)
editdist.add_command(label='Numerical', command=cmdnume)
editdist.add_command(label='Special', command=cmdspecial)
F2 = tk.Frame(sub, width=250, height=4)
F2.pack()
sub.resizable(width='true', height='false')
propbutton.pack()
propbutton.config(bg='white', bd=4, relief='raised')
distbutton.pack()
distbutton.config(bg='white', bd=4, relief='raised')
sub.mainloop()
# -*- coding: iso-8859-15 -*-
import Tkinter as tk
from Elements import *
from numpy import *
from pylab import *
from spectro import *
#######################################
# Initial parameters
param = dict(dedx=287. ,Theta_out=70., dW2dx=35000., E0= 100000., Theta_in=0., FWHM0=300.)
ionb = dict(Z=1, mass=1.0079)
#######################################
# Calculation callback
# Defines parameters
def init_calc():
param['dedx'] = float(Entrydedx.get())
param['dW2dx'] = float(EntrydW2dx.get())
param['Theta_out'] = float(EntryT_out.get())
param['Theta_in'] = float(EntryT_in.get())
param['E0'] = float(EntryE0.get())
param['FWHM0'] = float(EntryFWHM0.get())
ionb['mass'] = float(Entryionmass.get())
ionb['Z'] = float(EntryionZ.get())
data=spectro_espalhamento(float(EntryEmin.get()),float(EntryEmax.get()),20)
#data.addelements2(['profHf.dat','profO.dat'],param,0.9,'gaussiana',0.01)
data.sweepelements(param, 'gaussiana', ionb)
data.plot()
#######################################
# Main window
root = tk.Tk()
root.minsize(385,355)
root.title('Open Flatus')
Label1 = tk.Label(root, text = 'Elements', relief='raised', bd=2)
Label1.grid(column=0, row=9)
Label2 = tk.Label(root, text = 'Parameters', relief='raised', bd=2)
Label2.grid(column=0, row=0)
Label3 = tk.Label(root, text = 'Ion parameters', relief='raised', bd=2)
Label3.grid(column=0, row=2)
CalcButton = tk.Button(root, text = 'Calculate', command = init_calc, bd=4, width=20, height=4)
CalcButton.grid(column=10, row=10)
#######################################
# Frames
Eframe = tk.Frame(root)
Eframe.grid(column=0, row=10)
Pframel = tk.Frame(root)
Pframel.grid(column=0, row=1, sticky='w')
Pframee = tk.Frame(root)
Pframee.grid(column=0, row=1, sticky='e')
Iframel = tk.Frame(root, width=8)
Iframel.grid(column=0, row=3, sticky='w')
Iframee = tk.Frame(root, width=12)
Iframee.grid(column=0, row=3, sticky='e')
#######################################
# Elements callback
elemw(Eframe)
#######################################
# Parameters
# Labels
Labeldedx = tk.Label(Pframel, width=8, text='dƐ/dx')
LabeldW2dx = tk.Label(Pframel, width=8, text='dω²/dx')
LabelT_out = tk.Label(Pframel, width=8, text='θ out')
LabelT_in = tk.Label(Pframel, width=8, text='θ in')
LabelE0 = tk.Label(Pframel, width=8, text='E0')
LabelFWHM0 = tk.Label(Pframel, width=8, text='FWHM0')
LabelEmin = tk.Label(Pframel, width=8, text='Emin')
LabelEmax = tk.Label(Pframel, width=8, text='Emax')
Labeldedx.pack()
LabeldW2dx.pack()
LabelT_out.pack()
LabelT_in.pack()
LabelE0.pack()
LabelFWHM0.pack()
LabelEmin.pack()
LabelEmax.pack()
# Entries
Entrydedx = tk.Entry(Pframee, width=12)
EntrydW2dx = tk.Entry(Pframee, width=12)
EntryT_out = tk.Entry(Pframee, width=12)
EntryT_in = tk.Entry(Pframee, width=12)
EntryE0 = tk.Entry(Pframee, width=12)
EntryFWHM0 = tk.Entry(Pframee, width=12)
EntryEmin = tk.Entry(Pframee, width=12)
EntryEmax = tk.Entry(Pframee, width=12)
Entrydedx.pack()
EntrydW2dx.pack()
EntryT_out.pack()
EntryT_in.pack()
EntryE0.pack()
EntryFWHM0.pack()
EntryEmin.pack()
EntryEmax.pack()
#Ion
Labelionmass = tk.Label(Iframel, width=8, text='Mass')
LabelionZ = tk.Label(Iframel, width=8, text='Z')
Labelionmass.pack()
LabelionZ.pack()
Entryionmass = tk.Entry(Iframee, width=12)
EntryionZ = tk.Entry(Iframee, width=12)
Entryionmass.pack()
EntryionZ.pack()
#Initial values
Entrydedx.insert(0,param['dedx'])
EntrydW2dx.insert(0,param['dW2dx'])
EntryT_out.insert(0,param['Theta_out'])
EntryT_in.insert(0,param['Theta_in'])
EntryE0.insert(0,param['E0'])
EntryFWHM0.insert(0,param['FWHM0'])
EntryEmin.insert(0,50000)
EntryEmax.insert(0,100000)
Entryionmass.insert(0, ionb['mass'])
EntryionZ.insert(0, ionb['Z'])
#######################################
root.mainloop()
#######################################
import Tkinter as tk
from pylab import *
from ElementsDict import *
from subPTE import *
def plotdist(atom, button):
if atom['control']==0:
atom['control']=1
button['relief']='sunken'
print atom['control']
plot (distribution, atom['dist'])
show ()
if atom['control']==1:
atom['control']=0
button['relief']='raised'
print atom['control']
master = tk.Tk()
master.title('Periodic Table of Elements')
from PTEdict import *
from Eprop import atomsubmenu
####################################################
q1a = lambda: plotdist(H, b1)
q1 = lambda: atomsubmenu(H, b1)
b1 = tk.Button(master, text="H", command=q1, width=1, height=1, bg='white')
b1.pack()
q2 = lambda: atomsubmenu(He, b2)
b2 = tk.Button(master, text="He", command=q2, width=1, height=1, bg='pink')
b2.pack()
q3 = lambda: atomsubmenu(Li, b3)
b3 = tk.Button(master, text="Li", command=q3, width=1, height=1, bg='yellow')
b3.pack()
q4 = lambda: atomsubmenu(Be, b4)
b4 = tk.Button(master, text="Be", command=q4, width=1, height=1, bg='brown')
b4.pack()
q5 = lambda: atomsubmenu(B, b5)
b5 = tk.Button(master, text="B", command=q5, width=1, height=1, bg='blue')
b5.pack()
q6 = lambda: atomsubmenu(C, b6)
b6 = tk.Button(master, text="C", command=q6, width=1, height=1, bg='green')
b6.pack()
q7 = lambda: atomsubmenu(N, b7)
b7 = tk.Button(master, text="N", command=q7, width=1, height=1, bg='green')
b7.pack()
q8 = lambda: atomsubmenu(O, b8)
b8 = tk.Button(master, text="O", command=q8, width=1, height=1, bg='green')
b8.pack()
q9 = lambda: atomsubmenu(F, b9)
b9 = tk.Button(master, text="F", command=q9, width=1, height=1, bg='red')
b9.pack()
q10 = lambda: atomsubmenu(Ne, b10)
b10 = tk.Button(master, text="Ne", command=q10, width=1, height=1, bg='pink')
b10.pack()
q11 = lambda: atomsubmenu(Na, b11)
b11 = tk.Button(master, text="Na", command=q11, width=1, height=1, bg='yellow')
b11.pack()
q12 = lambda: atomsubmenu(Mg, b12)
b12 = tk.Button(master, text="Mg", command=q12, width=1, height=1, bg='brown')
b12.pack()
# PTE building
def PTable(Elem , Elembut):
####################################################
# Returns element parameters on click
def atomdef(atom, Ele, Eleb):
Eleb['text'] = atom['symbol']
Ele['name'] = atom['name']
Ele['mass'] = atom['mass']
Ele['Z'] = atom['Z']
Ele['symbol'] = atom['symbol']
master.destroy()
atomsubmenu(Elem, Elembut)
master = tk.Tk()
master.title('Periodic Table of Elements')
####################################################
q1 = lambda: atomdef(H, Elem, Elembut)
b1 = tk.Button(master, text="H", command=q1, width=1, height=1, bg='white')
b1.pack()
q2 = lambda: atomdef(He, Elem, Elembut)
b2 = tk.Button(master, text="He", command=q2, width=1, height=1, bg='pink')
b2.pack()
q3 = lambda: atomdef(Li, Elem, Elembut)
b3 = tk.Button(master, text="Li", command=q3, width=1, height=1, bg='yellow')
b3.pack()
q4 = lambda: atomdef(Be, Elem, Elembut)
b4 = tk.Button(master, text="Be", command=q4, width=1, height=1, bg='brown')
b4.pack()
q5 = lambda: atomdef(B, Elem, Elembut)
b5 = tk.Button(master, text="B", command=q5, width=1, height=1, bg='blue')
b5.pack()
q6 = lambda: atomdef(C, Elem, Elembut)
b6 = tk.Button(master, text="C", command=q6, width=1, height=1, bg='green')
b6.pack()
q7 = lambda: atomdef(N, Elem, Elembut)
b7 = tk.Button(master, text="N", command=q7, width=1, height=1, bg='green')
b7.pack()
q8 = lambda: atomdef(O, Elem, Elembut)
b8 = tk.Button(master, text="O", command=q8, width=1, height=1, bg='green')
b8.pack()
q9 = lambda: atomdef(F, Elem, Elembut)
b9 = tk.Button(master, text="F", command=q9, width=1, height=1, bg='red')
b9.pack()
q10 = lambda: atomdef(Ne, Elem, Elembut)
b10 = tk.Button(master, text="Ne", command=q10, width=1, height=1, bg='pink')
b10.pack()
q11 = lambda: atomdef(Na, Elem, Elembut)
b11 = tk.Button(master, text="Na", command=q11, width=1, height=1, bg='yellow')
b11.pack()
q12 = lambda: atomdef(Mg, Elem, Elembut)
b12 = tk.Button(master, text="Mg", command=q12, width=1, height=1, bg='brown')
b12.pack()
q13 = lambda: atomsubmenu(Al, b13)
b13 = tk.Button(master, text="Al", command=q13, width=1, height=1, bg='purple')
b13.pack()
q13 = lambda: atomdef(Al, Elem, Elembut)
b13 = tk.Button(master, text="Al", command=q13, width=1, height=1, bg='purple')
b13.pack()
q14 = lambda: atomsubmenu(Si, b14)
b14 = tk.Button(master, text="Si", command=q14, width=1, height=1, bg='blue')
b14.pack()
q14 = lambda: atomdef(Si, Elem, Elembut)
b14 = tk.Button(master, text="Si", command=q14, width=1, height=1, bg='blue')
b14.pack()
q15 = lambda: atomsubmenu(P, b15)
b15 = tk.Button(master, text="P", command=q15, width=1, height=1, bg='green')
b15.pack()
q15 = lambda: atomdef(P, Elem, Elembut)
b15 = tk.Button(master, text="P", command=q15, width=1, height=1, bg='green')
b15.pack()
q16 = lambda: atomsubmenu(S, b16)
b16 = tk.Button(master, text="S", command=q16, width=1, height=1, bg='green')
b16.pack()
q16 = lambda: atomdef(S, Elem, Elembut)
b16 = tk.Button(master, text="S", command=q16, width=1, height=1, bg='green')
b16.pack()
q17 = lambda: atomsubmenu(Cl, b17)
b17 = tk.Button(master, text="Cl", command=q17, width=1, height=1, bg='red')
b17.pack()
q17 = lambda: atomdef(Cl, Elem, Elembut)
b17 = tk.Button(master, text="Cl", command=q17, width=1, height=1, bg='red')
b17.pack()
q18 = lambda: atomsubmenu(Ar, b18)
b18 = tk.Button(master, text="Ar", command=q18, width=1, height=1, bg='pink')
b18.pack()
q18 = lambda: atomdef(Ar, Elem, Elembut)
b18 = tk.Button(master, text="Ar", command=q18, width=1, height=1, bg='pink')
b18.pack()
q19 = lambda: atomsubmenu(K, b19)
b19 = tk.Button(master, text="K", command=q19, width=1, height=1, bg='yellow')
b19.pack()
q19 = lambda: atomdef(K, Elem, Elembut)
b19 = tk.Button(master, text="K", command=q19, width=1, height=1, bg='yellow')
b19.pack()
q20 = lambda: atomsubmenu(Ca, b20)
b20 = tk.Button(master, text="Ca", command=q20, width=1, height=1, bg='brown')
b20.pack()
q20 = lambda: atomdef(Ca, Elem, Elembut)
b20 = tk.Button(master, text="Ca", command=q20, width=1, height=1, bg='brown')
b20.pack()
q21 = lambda: atomsubmenu(Sc, b21)
b21 = tk.Button(master, text="Sc", command=q21, width=1, height=1)
b21.pack()
q21 = lambda: atomdef(Sc, Elem, Elembut)
b21 = tk.Button(master, text="Sc", command=q21, width=1, height=1)