phy_atomic.py

Created by antarctus

Created on November 21, 2021

5.25 KB

Tableau atomique d’après celui d’Omega.


Vous pouvez me contacter sur Discord à l’aide de ce lien https://discord.gg/wNtEFdQgWD.
N’hésitez pas à venir, vous pourriez découvrir des choses intéressantes…


from kandinsky import *
from ion import *
from time import *
from random import *

e2="e"+chr(768)
e1="e"+chr(769)

periodic=(
("H" ,0,"Hydrog"+e2+"ne",0),
("He",2,"H"+e1+"lium",1),
("Li",4,"Lithium",2),
("Be",5,"B"+e1+"ryllium",3),
("B" ,6,"Bore",4),
("C" ,6,"Carbone",0),
("N" ,7,"Azote",0),
("O" ,8,"Oxyg"+e2+"ne",0),
("F" ,10,"Fluor",5),
("Ne",10,"N"+e1+"on",1),
("Na",12,"Sodium",2),
("Mg",12,"Magn"+e1+"sium",3),
("Al",14,"Aluminium",6),
("Si",14,"Silicium",4),
("Ph",16,"Phosphore",0),
("S" ,16,"Soufre",0),
("Cl",18,"Chlore",5),
("Ar",22,"Argon",1),
("K" ,20,"Potassium",2),
("Ca",20,"Calcium",3),
("Sc",24,"Scandium",7),
("Ti",26,"Titane",7),
("V" ,28,"Vanadium",7),
("Cr",28,"Chrome",7),
("Mn",30,"Mangan"+e2+"se",7),
("Fe",30,"Fer",7),
("Co",32,"Cobalt",7),
("Ni",31,"Nickel",7),
("Cu",34,"Cuivre",7),
("Zn",34,"Zinc",6),
("Ga",38,"Gallium",6),
("Ge",42,"Germanium",4),
("As",42,"Arsenic",4),
("Se",46,"S"+e1+"l"+e1+"nium",0),
("Br",44,"Brome",5),
("Kr",48,"Krypton",1),
("Rb",48,"Rubidium",2),
("Sr",50,"Strontium",3),
("Y" ,50,"Yttrium",7),
("Zr",50,"Zirconium",7),
("Nb",52,"Nobium",7),
("Mo",56,"Molybd"+e2+"ne",7),
("Tc",56,"Techn"+e1+"tium",7),
("Ru",58,"Ruthenium",7),
("Rh",58,"Rhodium",7),
("Pd",60,"Palladium",7),
("Ag",60,"Argent",7),
("Cd",66,"Cadium",6),
("In",66,"Indium",6),
("Sn",70,"Etain",6),
("Sb",70,"Antimoine",4),
("Te",78,"Tellure",4),
("I" ,74,"Iode",5),
("Xe",78,"X"+e1+"non",1),
("Cs",78,"C"+e1+"sium",2),
("Ba",81,"Barium",3),
("La",82,"Lanthane",8),
("Ce",82,"C"+e1+"rium",8),
("Pr",82,"Pras"+e1+"odyme",8),
("Nd",84,"N"+e1+"odyme",8),
("Pm",84,"Prom"+e1+"thium",8),
("Sm",88,"Samarium",8),
("Eu",89,"Europium",8),
("Gd",93,"Gadolidium",8),
("Tr",94,"Terbium",8),
("Dy",97,"Dyxprosium",8),
("Ho",98,"Holmium",8),
("Er",99,"Erbium",8),
("Tm",100,"Thulium",8),
("Yb",103,"Ytterbium",8),
("Lu",104,"Lut"+e1+"tium",8),
("Hf",106,"Hafnium",7),
("Ta",108,"Tantale",7),
("W" ,110,"Tungst"+e2+"ne",7),
("Re",111,"Rh"+e1+"nium",7),
("Os",114,"Osmium",7),
("Ir",115,"Iridium",7),
("Pt",117,"Platine",7),
("Au",118,"Or",7),
("Hg",121,"Mercure",6),
("Tl",123,"Thalium",6),
("Pb",125,"Plomb",6),
("Bi",126,"Bismuth",6),
("Po",125,"Polonium",6),
("At",125,"Astatine",5),
("Rn",136,"Radon",1),
("Fr",136,"Francium",2),
("Ra",138,"Radium",3),
("Ac",138,"Actinium",9),
("Th",142,"Thorium",9),
("Pa",140,"Protactinium",9),
("U" ,146,"Uranium",9),
("Np",144,"Neptunium",9),
("Pu",150,"Plutonium",9),
("Am",146,"Am"+e1+"ricium",9),
("Cm",151,"Curium",9),
("Bk",150,"Berkelium",9),
("Cf",153,"Californium",9),
("Es",153,"Einsteinium",9),
("Fm",157,"Fermium",9),
("Md",157,"Medelevium",9),
("No",157,"Nobelium",9),
("Lr",163,"Lawrencium",9),
("Rf",163,"Rutherfordium",7),
("Db",163,"Dubnium",7),
("Sg",163,"Seaborgium",7),
("Bh",163,"Bohrium",7),
("Hs",169,"Hassnium",7),
("Mt",169,"Metnerium",10),
("Ds",171,"Darmstadtium",10),
("Rt",171,"Roentgenium",10),
("Cn",173,"Copernicium",6),
("Nh",173,"Nihonium",10),
("Fl",175,"Flerovium",10),
("Mc",174,"Moscovium",10),
("Lv",177,"Livermorium",10),
("Ts",177,"Tennessine",10),
("Og",176,"Oganesson",1),
)#("",),

type=(
("Reactifs non metalique",(0,200,0)),
("Gaz noble",(0,200,200)),
("Metal alcalin",(255,0,0)),
("Metal alcalino-terreux",(255,0,255)),
("Metalloide",(60,60,160)),
("Halogene",(255,200,0)),
("Metal post-transition",(180,150,50)),
("Metal de transition",(130,50,0)),
("Lanthanides",(150,75,150)),
("Actinides",(248, 188, 56)),
("Inconnu",(180,)*3),
)

coords=[(0,0),(17,0)]
for y in range(2):
  for x in range(8):
    coords+=[([0,1,12,13,14,15,16,17][x],y+1)]
for y in range(2):
  for x in range(18):
    coords+=[(x,y+3)]
for y in range(2):
  for x in range(2):
    coords+=[(x,y+5)]
  for x in range(15):
    coords+=[(x+3,y+8)]
  for x in range(15):
    coords+=[(x+3,y+5)]


def draw_elem(n,focus=False):
  x,y=coords[n]
  atom=periodic[n]
  col=type[atom[3]][1]
  if focus:
    col=(int(col[0]*3/5),int(col[1]*3/5),int(col[2]*3/5))
  fill_rect(7+x*17,10+y*18,17,18,col)
  if len(atom[0])==2:
    draw_string(atom[0][1],8+7+x*17,10+y*18,col_write,col)
    draw_string(atom[0][0],7+x*17,10+y*18,col_write,col)
    if atom[0][1] in "kbpomw":
      draw_string(atom[0][1],8+7+x*17,10+y*18,col_write,col)
  else:
    draw_string(atom[0][0],10+x*17,10+y*18,col_write,col)

def move():
  global cursor

  cursor+=keydown(KEY_RIGHT)-keydown(KEY_LEFT)
  cursor%=len(periodic)
  coo=coords[cursor]
  for i in [-1,1]:
    if keydown([None,KEY_DOWN,KEY_UP][i]):
      if (coo[0],coo[1]+1*i) in coords:
        cursor=coords.index((coo[0],coo[1]+1*i),)
      elif (coo[0],coo[1]+2*i) in coords:
        cursor=coords.index((coo[0],coo[1]+2*i),)


last_cursor=-1
cursor=0
col_write=(255,)*3

for i in range(len(periodic)):
  draw_elem(i,i==cursor)

fill_rect(49,108,3,74,(0,)*3)

l=["d'apre"+chr(768)+"s celui d'Omega (+ cool)",]*10+["Omega > Numworks","Avez-vous test"+e1+" Omega ?","Fait par Antarctus"]
draw_string("{:^32}".format(choice(l)),10,202)

while True:
  move()
  draw_elem(cursor,True)
  if last_cursor!=cursor:
    draw_elem(last_cursor,False)
    last_cursor=cursor
    fill_rect(7+17,10,272,18,(255,)*3)
    fill_rect(8+34,28,169,36,(255,)*3)
    draw_string(periodic[cursor][2],110,10)
    draw_string(periodic[cursor][0],80,20)
    draw_string("{:>3}".format(str(cursor+1)),50,11)
    draw_string("{:>3}".format(str(periodic[cursor][1]+cursor+1)),50,29)
  sleep(0.1)

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.