Jump to content

Can someone help me optimize this?

- - - - -

  • Please log in to reply
No replies to this topic

#1
Waffles

Waffles

    Newbie

  • Members
  • Pip
  • 7 posts
So, I decided to make a Periodic Table app in python, and I am around half done entering all of the data for each element, and I'm done with everything I can see to add.. But It's kinda slow for just opening info boxes, any ideas on what I can do to optimize/improve the code?

Also:
Is there any pop-up window in Python that DOESNT make a little beeping noise every time? Thanks.

#Impot modules

import Tkinter

from Tkinter import *

import tkFont

from tkFont import *

import tkMessageBox


#Define the name of the window loop

top = Tkinter.Tk()


#Define the variables of the title font

Times = tkFont.Font(family="Times", size=16, weight="bold", slant="italic")


#Start Defining Objects For The Elements

    #Each object creates a function that is later attatched to a button

        #Need to make the little beeping sound stop when window is opened by pressing button

def Hydrogen():

    tkMessageBox.showinfo("Hydrogen-Info", """

Name: Hydrogen

Symbol: H

Atomic number: 1

Atomic weight: 1.00794

Standard state: gas at 298 K

CAS Registry ID: 1333-74-0

Group in periodic table: 1

Group name: (none)

Period in periodic table: 1

Block in periodic table: s-block

Colour: colourless

Classification: Non-metallic

""")


def Helium():

    tkMessageBox.showinfo("Helium-Info", """

Name: Helium

Symbol: He

Atomic number: 2

Atomic weight: 4.002602

Standard state: gas at 298 K

CAS Registry ID: 7440-59-7

Group in periodic table: 18

Group name: Noble gas

Period in periodic table: 1

Block in periodic table: p-block

Colour: colourless

Classification: Non-metallic

""")


def Lithium():

    tkMessageBox.showinfo("Lithium-Info", """

Name: Lithium

Symbol: Li

Atomic number: 3

Atomic weight: 6.941

Standard state: solid at 298 K

CAS Registry ID: 7439-93-2

Group in periodic table: 1

Group name: Alkali metal

Period in periodic table: 2

Block in periodic table: s-block

Colour: silvery white/grey

Classification: Metallic

""")


def Beryllium():

    tkMessageBox.showinfo("Beryllium-Info", """

Name: Beryllium

Symbol: Be

Atomic number: 4

Atomic weight: 9.012182

Standard state: solid at 298 K

CAS Registry ID: 7440-41-7

Group in periodic table: 2

Group name: Alkaline earth metal

Period in periodic table: 2

Block in periodic table: s-block

Colour: lead grey

Classification: Metallic""")


def Boron():

    tkMessageBox.showinfo("Boron-Info", """

Name: Boron

Symbol: B

Atomic number: 5

Atomic weight: 10.811

Standard state: solid at 298 K

CAS Registry ID: 7440-42-8

Group in periodic table: 13

Group name: (none)

Period in periodic table: 2

Block in periodic table: p-block

Colour: black

Classification: Semi-metallic""")


def Carbon():

    tkMessageBox.showinfo("Carbon-Info", """

Name: Carbon

Symbol: C

Atomic number: 6

Atomic weight: 12.0107

Standard state: solid at 298 K

CAS Registry ID: 7440-44-0

Group in periodic table: 14

Group name: (none)

Period in periodic table: 2

Block in periodic table: p-block

Colour: graphite is black, diamond is colourless

Classification: Non-metallic""")


def Nitrogen():

    tkMessageBox.showinfo("Nitrogen-Info", """

Name: Nitrogen

Symbol: N

Atomic number: 7

Atomic weight: 14.0067

Standard state: gas at 298 K

CAS Registry ID: 7727-37-9

Group in periodic table: 15

Group name: Pnictogen

Period in periodic table: 2

Block in periodic table: p-block

Colour: colourless

Classification: Non-metallic""")


def Oxygen():

    tkMessageBox.showinfo("Oxygen-Info", """

Name: Oxygen

Symbol: O

Atomic number: 8

Atomic weight: 15.9994

Standard state: gas at 298 K

CAS Registry ID: 7782-44-7

Group in periodic table: 16

Group name: Chalcogen

Period in periodic table: 2

Block in periodic table: p-block

Colour: colourless as a gas, liquid is pale blue

Classification: Non-metallic""")


def Flourine():

    tkMessageBox.showinfo("Flourine-Info", """

Name: Fluorine

Symbol: F

Atomic number: 9

Atomic weight: 18.9984032

Standard state: gas at 298 K

CAS Registry ID: 7782-41-4

Group in periodic table: 17

Group name: Halogen

Period in periodic table: 2

Block in periodic table: p-block

Colour: pale yellow

Classification: Non-metallic""")


def Neon():

    tkMessageBox.showinfo("Neon-Info", """

Name: Neon

Symbol: Ne

Atomic number: 10

Atomic weight: 20.1797

Standard state: gas at 298 K

CAS Registry ID: 7440-01-9

Group in periodic table: 18

Group name: Noble gas

Period in periodic table: 2

Block in periodic table: p-block

Colour: colourless

Classification: Non-metallic""")


def Sodium():

    tkMessageBox.showinfo("Sodium-Info", """

Name: Sodium

Symbol: Na

Atomic number: 11

Atomic weight: 22.98976928 (2)

Standard state: solid at 298 K

CAS Registry ID: 7440-23-5

Group in periodic table: 1

Group name: Alkali metal

Period in periodic table: 3

Block in periodic table: s-block

Colour: silvery white

Classification: Metallic""")


def Magnesium():

    tkMessageBox.showinfo("Magnesium-Info", """

Name: Magnesium

Symbol: Mg

Atomic number: 12

Atomic weight: 24.3050

Standard state: solid at 298 K

CAS Registry ID: 7439-95-4

Group in periodic table: 2

Group name: Alkaline earth metal

Period in periodic table: 3

Block in periodic table: s-block

Colour: silvery white

Classification: Metallic""")


def Aluminum():

    tkMessageBox.showinfo("Aluminum-Info", """

Name: Aluminium

Symbol: Al

Atomic number: 13

Atomic weight: 26.9815386

Standard state: solid at 298 K

CAS Registry ID: 7429-90-5

Group in periodic table: 13

Group name: (none)

Period in periodic table: 3

Block in periodic table: p-block

Colour: silvery

Classification: Me""")


def Silicon():

    tkMessageBox.showinfo("Silicon-Info", """

Name: Silicon

Symbol: Si

Atomic number: 14

Atomic weight: 28.0855

Standard state: solid at 298 K

CAS Registry ID: 7440-21-3

Group in periodic table: 14

Group name: (none)

Period in periodic table: 3

Block in periodic table: p-block

Colour: dark grey with a bluish tinge

Classification: Semi-metallic""")


def Phosphorus():

    tkMessageBox.showinfo("Phosphorus-Info", """

Name: Phosphorus

Symbol: P

Atomic number: 15

Atomic weight: 30.973762

Standard state: solid at 298 K

CAS Registry ID: 7723-14-0

Group in periodic table: 15

Group name: Pnictogen

Period in periodic table: 3

Block in periodic table: p-block

Colour: colourless/red/silvery white

Classification: Non-metal""")


def Sulfur():

    tkMessageBox.showinfo("Sulfu-Info", """

Name: Sulfur

Symbol: S

Atomic number: 16

Atomic weight: 32.065

Standard state: solid at 298 K

CAS Registry ID: 7704-34-9

Group in periodic table: 16

Group name: Chalcogen

Period in periodic table: 3

Block in periodic table: p-block

Colour: lemon yellow

Classification: Non-metallic""")


def Chlorine():

    tkMessageBox.showinfo("Chlorine-Info", """

Name: Chlorine

Symbol: Cl

Atomic number: 17

Atomic weight: 35.453

Standard state: gas at 298 K

CAS Registry ID: 7782-50-5

Group in periodic table: 17

Group name: Halogen

Period in periodic table: 3

Block in periodic table: p-block

Colour: yellowish green

Classification: Non-metallic""")


def Argon():

    tkMessageBox.showinfo("Argon-Info", """

Name: Argon

Symbol: Ar

Atomic number: 18

Atomic weight: 39.948

Standard state: gas at 298 K

CAS Registry ID: 7440-37-1

Group in periodic table: 18

Group name: Noble gas

Period in periodic table: 3

Block in periodic table: p-block

Colour: colourless

Classification: Non-metallic""")


def Potassium():

    tkMessageBox.showinfo("Potassium-Info", """

Name: Potassium

Symbol: K

Atomic number: 19

Atomic weight: 39.0983

Standard state: solid at 298 K

CAS Registry ID: 7440-09-7

Group in periodic table: 1

Group name: Alkali metal

Period in periodic table: 4

Block in periodic table: s-block

Colour: silvery white

Classification: Metallic""")


def Calcium():

    tkMessageBox.showinfo("Calcium-Info", """

Name: Calcium

Symbol: Ca

Atomic number: 20

Atomic weight: 40.078

Standard state: solid at 298 K

CAS Registry ID: 7440-70-2

Group in periodic table: 2

Group name: Alkaline earth metal

Period in periodic table: 4

Block in periodic table: s-block

Colour: silvery white

Classification: Metallic""")


def Scandium():

    tkMessageBox.showinfo("Scandium-Info", """

Name: Scandium

Symbol: Sc

Atomic number: 21

Atomic weight: 44.955912

Standard state: solid at 298 K

CAS Registry ID: 7440-20-2

Group in periodic table: 3

Group name: (none)

Period in periodic table: 4

Block in periodic table: d-block

Colour: silvery white

Classification: Metallic""")


def Titanium():

    tkMessageBox.showinfo("Titanium-Info", """

Name: Titanium

Symbol: Ti

Atomic number: 22

Atomic weight: 47.867

Standard state: solid at 298 K

CAS Registry ID: 7440-32-6

Group in periodic table: 4

Group name: (none)

Period in periodic table: 4

Block in periodic table: d-block

Colour: silvery metallic

Classification: Metallic""")


def Vanadium():

    tkMessageBox.showinfo("Vanadium-Info", """

Name: Vanadium

Symbol: V

Atomic number: 23

Atomic weight: 50.9415

Standard state: solid at 298 K

CAS Registry ID: 7440-62-2

Group in periodic table: 5

Group name: (none)

Period in periodic table: 4

Block in periodic table: d-block

Colour: silvery grey metallic

Classification: Metallic""")


def Chromium():

    tkMessageBox.showinfo("Chromium-Info", """

Name: Chromium

Symbol: Cr

Atomic number: 24

Atomic weight: 51.9961

Standard state: solid at 298 K

CAS Registry ID: 7440-47-3

Group in periodic table: 6

Group name: (none)

Period in periodic table: 4

Block in periodic table: d-block

Colour: silvery metallic

Classification: Metallic""")


def Managnese():

    tkMessageBox.showinfo("Manganese-Info", """

Name: Manganese

Symbol: Mn

Atomic number: 25

Atomic weight: 54.938045

Standard state: solid at 298 K

CAS Registry ID: 7439-96-5

Group in periodic table: 7

Group name: (none)

Period in periodic table: 4

Block in periodic table: d-block

Colour: silvery metallic

Classification: Metallic""")


def Iron():

    tkMessageBox.showinfo("Iron-Info", """

Name: Iron

Symbol: Fe

Atomic number: 26

Atomic weight: 55.845

Standard state: solid at 298 K

CAS Registry ID: 7439-89-6

Group in periodic table: 8

Group name: (none)

Period in periodic table: 4

Block in periodic table: d-block

Colour: lustrous, metallic, greyish tinge

Cl""")


def Cobalt():

    tkMessageBox.showinfo("Cobalt-Info", """

Name: Cobalt

Symbol: Co

Atomic number: 27

Atomic weight: 58.933195

Standard state: solid at 298 K

CAS Registry ID: 7440-48-4

Group in periodic table: 9

Group name: (none)

Period in periodic table: 4

Block in periodic table: d-block

Colour: lustrous, metallic, greyish tinge

Classification: Metallic""")


def Nickel():

    tkMessageBox.showinfo("Nickel-Info", """

Name: Nickel

Symbol: Ni

Atomic number: 28

Atomic weight: 58.6934

Standard state: solid at 298 K

CAS Registry ID: 7440-02-0

Group in periodic table: 10

Group name: (none)

Period in periodic table: 4

Block in periodic table: d-block

Colour: lustrous, metallic, silvery tinge

Classification: Metallic""")


def Copper():

    tkMessageBox.showinfo("Copper-Info", """

Name: Copper

Symbol: Cu

Atomic number: 29

Atomic weight: 63.546

Standard state: solid at 298 K

CAS Registry ID: 7440-50-8

Group in periodic table: 11

Group name: Coinage metal

Period in periodic table: 4

Block in periodic table: d-block

Colour: copper, metallic

Classification: Metallic""")


def Zinc():

    tkMessageBox.showinfo("Zinc-Info", """

Name: Zinc

Symbol: Zn

Atomic number: 30

Atomic weight: 65.38

Standard state: solid at 298 K

CAS Registry ID: 7440-66-6

Group in periodic table: 12

Group name: (none)

Period in periodic table: 4

Block in periodic table: d-block

Colour: bluish pale grey

Classification: Metallic""")


def Gallium():

    tkMessageBox.showinfo("Gallium-Info", """

Name: Gallium

Symbol: Ga

Atomic number: 31

Atomic weight: 69.723

Standard state: solid at 298 K

CAS Registry ID: 7440-55-3

Group in periodic table: 13

Group name: (none)

Period in periodic table: 4

Block in periodic table: p-block

Colour: silvery white

Classification: Metallic""")


def Germanium():

    tkMessageBox.showinfo("Germanium-Info", """

Name: Germanium

Symbol: Ge

Atomic number: 32

Atomic weight: 72.64

Standard state: solid at 298 K

CAS Registry ID: 7440-56-4

Group in periodic table: 14

Group name: (none)

Period in periodic table: 4

Block in periodic table: p-block

Colour: greyish white

Classification: Semi-metallic""")


def Arsenic():

    tkMessageBox.showinfo("Arsenic-Info", """

Name: Arsenic

Symbol: As

Atomic number: 33

Atomic weight: 74.92160

Standard state: solid at 298 K

CAS Registry ID: 7440-38-2

Group in periodic table: 15

Group name: Pnictogen

Period in periodic table: 4

Block in periodic table: p-block

Colour: metallic grey

Classification: Semi-metallic""")


def Selenium():

    tkMessageBox.showinfo("Selenium-Info", """

Name: Selenium

Symbol: Se

Atomic number: 34

Atomic weight: 78.96

Standard state: solid at 298 K

CAS Registry ID: 7782-49-2

Group in periodic table: 16

Group name: Chalcogen

Period in periodic table: 4

Block in periodic table: p-block

Colour: grey, metallic lustre

Classification: Non-metallic""")


def Bromine():

    tkMessageBox.showinfo("Bromine-Info", """

Name: Bromine

Symbol: Br

Atomic number: 35

Atomic weight: 79.904

Standard state: liquid at 298 K

CAS Registry ID: 7726-95-6

Group in periodic table: 17

Group name: Halogen

Period in periodic table: 4

Block in periodic table: p-block

Colour: red-brown, metallic lustre when solid

Cl""")


def Krypton():

    tkMessageBox.showinfo("Krypton", """

Name: Krypton

Symbol: Kr

Atomic number: 36

Atomic weight: 83.798

Standard state: gas at 298 K

CAS Registry ID: 7439-90-9

Group in periodic table: 18

Group name: Noble gas

Period in periodic table: 4

Block in periodic table: p-block

Colour: colourless

Classification: Non-metallic""")


def Rubidium():

    tkMessageBox.showinfo("Rubidium-Info", """

Name: Rubidium

Symbol: Rb

Atomic number: 37

Atomic weight: 85.4678

Standard state: solid at 298 K

CAS Registry ID: 7440-17-7

Group in periodic table: 1

Group name: Alkali metal

Period in periodic table: 5

Block in periodic table: s-block

Colour: silvery white

Classification: Metallic""")


def Strontium():

    tkMessageBox.showinfo("Strontium-Info", """

Name: Strontium

Symbol: Sr

Atomic number: 38

Atomic weight: 87.62

Standard state: solid at 298 K

CAS Registry ID: 7440-24-6

Group in periodic table: 2

Group name: Alkaline earth metal

Period in periodic table: 5

Block in periodic table: s-block

Colour: silvery white

Classification: Metallic""")


def Yttrium():

    tkMessageBox.showinfo("Yttrium-Info", """

Name: Yttrium

Symbol: Y

Atomic number: 39

Atomic weight: 88.90585

Standard state: solid at 298 K

CAS Registry ID: 7440-65-5

Group in periodic table: 3

Group name: (none)

Period in periodic table: 5

Block in periodic table: d-block

Colour: silvery white

Classification: Metallic""")


def Zirconium():

    tkMessageBox.showinfo("Zirconium-Info", """

Name: Zirconium

Symbol: Zr

Atomic number: 40

Atomic weight: 91.224

Standard state: solid at 298 K

CAS Registry ID: 7440-67-7

Group in periodic table: 4

Group name: (none)

Period in periodic table: 5

Block in periodic table: d-block

Colour: silvery white

Classification: Metallic""")


def Niobium():

    tkMessageBox.showinfo("Niobium-Info", """

Name: Niobium

Symbol: Nb

Atomic number: 41

Atomic weight: 92.90638

Standard state: solid at 298 K

CAS Registry ID: 7440-03-1

Group in periodic table: 5

Group name: (none)

Period in periodic table: 5

Block in periodic table: d-block

Colour: grey metallic

Classification: Metallic""")


def Molybdenum():

    tkMessageBox.showinfo("Molybdenum-Info", """

Name: Molybdenum

Symbol: Mo

Atomic number: 42

Atomic weight: 95.96

Standard state: solid at 298 K

CAS Registry ID: 7439-98-7

Group in periodic table: 6

Group name: (none)

Period in periodic table: 5

Block in periodic table: d-block

Colour: grey metallic

Classification: Metallic""")


def Technetium():

    tkMessageBox.showinfo("Technetium-Info", """

Name: Technetium

Symbol: Tc

Atomic number: 43

Atomic weight: 98

Standard state: solid at 298 K

CAS Registry ID: 7440-26-8

Group in periodic table: 7

Group name: (none)

Period in periodic table: 5

Block in periodic table: d-block

Colour: silvery grey metallic

Classification: Metallic""")


def Ruthenium():

    tkMessageBox.showinfo("Ruthenium-Info", """

Name: Ruthenium

Symbol: Ru

Atomic number: 44

Atomic weight: 101.07

Standard state: solid at 298 K

CAS Registry ID: 7440-18-8

Group in periodic table: 8

Group name: Precious metal or Platinum group metal

Period in periodic table: 5

Block in periodic table: d-block

Colour: silvery white metallic

Classification: Metallic""")


def Rhodium():

    tkMessageBox.showinfo("Rhodium-Info", """

Name: Rhodium

Symbol: Rh

Atomic number: 45

Atomic weight: 102.90550

Standard state: solid at 298 K

CAS Registry ID: 7440-16-6

Group in periodic table: 9

Group name: Precious metal or Platinum group metal

Period in periodic table: 5

Block in periodic table: d-block

Colour: silvery white metallic

Classif""")


def Palladium():

    tkMessageBox.showinfo("Palladium-Info", """

Name: Palladium

Symbol: Pd

Atomic number: 46

Atomic weight: 106.42

Standard state: solid at 298 K

CAS Registry ID: 7440-05-3

Group in periodic table: 10

Group name: Precious metal or Platinum group metal

Period in periodic table: 5

Block in periodic table: d-block

Colour: silvery white metallic

Classification: Metallic""")


def Silver():

    tkMessageBox.showinfo("Silver-Info", """

Name: Silver

Symbol: Ag

Atomic number: 47

Atomic weight: 107.8682

Standard state: solid at 298 K

CAS Registry ID: 7440-22-4

Group in periodic table: 11

Group name: Coinage metal

Period in periodic table: 5

Block in periodic table: d-block

Colour: silver

Classification: Metallic""")


def Cadmium():

    tkMessageBox.showinfo("Cadmium-Info", """

Name: Cadmium

Symbol: Cd

Atomic number: 48

Atomic weight: 112.411

Standard state: solid at 298 K

CAS Registry ID: 7440-43-9

Group in periodic table: 12

Group name: (none)

Period in periodic table: 5

Block in periodic table: d-block

Colour: silvery grey metallic

Classification: Metallic""")


def Indium():

    tkMessageBox.showinfo("Indium-Info", """

Name: Indium

Symbol: In

Atomic number: 49

Atomic weight: 114.818

Standard state: solid at 298 K

CAS Registry ID: 7440-74-6

Group in periodic table: 13

Group name: (none)

Period in periodic table: 5

Block in periodic table: p-block

Colour: silvery lustrous grey

Classification: Metallic""")


def Tin():

    tkMessageBox.showinfo("Tin-Info", """

Name: Tin

Symbol: Sn

Atomic number: 50

Atomic weight: 118.710

Standard state: solid at 298 K

CAS Registry ID: 7440-31-5

Group in periodic table: 14

Group name: (none)

Period in periodic table: 5

Block in periodic table: p-block

Colour: silvery lustrous grey

Classification: Metallic""")


def Antimony():

    tkMessageBox.showinfo("Antimony-Info", """

Name: Antimony

Symbol: Sb

Atomic number: 51

Atomic weight: 121.760

Standard state: solid at 298 K

CAS Registry ID: 7440-36-0

Group in periodic table: 15

Group name: Pnictogen

Period in periodic table: 5

Block in periodic table: p-block

Colour: silvery lustrous grey

Classification: Semi-metallic""")


def Tellurium():

    tkMessageBox.showinfo("Tellurium-Info", """

Name: Tellurium

Symbol: Te

Atomic number: 52

Atomic weight: 127.60

Standard state: solid at 298 K

CAS Registry ID: 13494-80-9

Group in periodic table: 16

Group name: Chalcogen

Period in periodic table: 5

Block in periodic table: p-block

Colour: silvery lustrous grey

Classification: Semi-metallic""")


def Iodine():

    tkMessageBox.showinfo("Iodine-Info", """

Name: Iodine

Symbol: I

Atomic number: 53

Atomic weight: 126.90447

Standard state: solid at 298 K

CAS Registry ID: 7553-56-2

Group in periodic table: 17

Group name: Halogen

Period in periodic table: 5

Block in periodic table: p-block

Colour: violet-dark grey, lustrous

Classification: Non-metallic""")


def Xenon():

    tkMessageBox.showinfo("Xenon-Info", """

Name: Xenon

Symbol: Xe

Atomic number: 54

Atomic weight: 131.293

Standard state: gas at 298 K

CAS Registry ID: 7440-63-3

Group in periodic table: 18

Group name: Noble gas

Period in periodic table: 5

Block in periodic table: p-block

Colour: colourless

Classification: Non-metallic""")


#Will finish

def Cesium():

    tkMessageBox.showinfo("Cesium-Info", """

""")


def Barium():

    tkMessageBox.showinfo("Barium-Info", """

""")


def Lanthanum():

    tkMessageBox.showinfo("Lanthanum-Info", """

""")


def Cerium():

    tkMessageBox.showinfo("Cerium-Info", """

""")


def Praseodymium():

    tkMessageBox.showinfo("Paraseodymium-Info", """

""")


def Promethium():

    tkMessageBox.showinfo("Promethium-Info", """

""")


def Neodymium():

    tkMessageBox.showinfo("Neodymium-Info", """

""")


def Samarium():

    tkMessageBox.showinfo("Samarium-Info", """

""")


def Europium():

    tkMessageBox.showinfo("Europium-Info", """

""")


def Gadolinium():

    tkMessageBox.showinfo("Gadolinium-Info", """

""")


def Terbium():

    tkMessageBox.showinfo("Terbium-Info", """

""")


def Dysporsium():

    tkMessageBox.showinfo("Dysprosium-Info", """

""")


def Holmium():

    tkMessageBox.showinfo("Holmium-Info", """

""")


def Erbium():

    tkMessageBox.showinfo("Erbium-Info", """

""")


def Thulium():

    tkMessageBox.showinfo("Thulium-Info", """

""")


def Ytterbium():

    tkMessageBox.showinfo("Ytterbium-Info", """

""")


def Lutetium():

    tkMessageBox.showinfo("Lutetium-Info", """

""")


def Hafnium():

    tkMessageBox.showinfo("Hafnium-Info", """

""")


def Tantalum():

    tkMessageBox.showinfo("Tantalum-Info", """

""")


def Tungsten():

    tkMessageBox.showinfo("Tungsten-Info", """

""")


def Rhenium():

    tkMessageBox.showinfo("Rhenium-Info", """

""")


def Osmium():

    tkMessageBox.showinfo("Osmium-Info", """

""")


def Iridium():

    tkMessageBox.showinfo("Iridium-Info", """

""")


def Platinum():

    tkMessageBox.showinfo("Platinum-Info", """

""")


def Gold():

    tkMessageBox.showinfo("Gold-Info", """

""")


def Mercury():

    tkMessageBox.showinfo("Mercury-Info", """

""")


def Thallium():

    tkMessageBox.showinfo("Thallium-Info", """

""")


def Lead():

    tkMessageBox.showinfo("Lead-Info", """

""")


def Bismuth():

    tkMessageBox.showinfo("Bismuth-Info", """

""")


def Polonium():

    tkMessageBox.showinfo("Polonium-Info", """

""")


def Astatine():

    tkMessageBox.showinfo("Astatine-Info", """

""")


def Radon():

    tkMessageBox.showinfo("Radon-Info", """

""")


def Francium():

    tkMessageBox.showinfo("Francium-Info", """

""")


def Radium():

    tkMessageBox.showinfo("Radium-Info", """

""")


def Actinium():

    tkMessageBox.showinfo("Actinium-Info", """

""")


def Thorium():

    tkMessageBox.showinfo("Thorium-Info", """

""")


def Protactinium():

    tkMessageBox.showinfo("Protactinium-Info", """

""")


def Uranium():

    tkMessageBox.showinfo("Uranium-Info", """

""")


def Neptunium():

    tkMessageBox.showinfo("Neptunium-Info", """

""")


def Plutonium():

    tkMessageBox.showinfo("Plutonium-Info", """

""")


def Americium():

    tkMessageBox.showinfo("Americium-Info", """

""")


def Curium():

    tkMessageBox.showinfo("Curium-Info", """

""")


def Berkelium():

    tkMessageBox.showinfo("Berkelium-Info", """

""")


def Californium():

    tkMessageBox.showinfo("Californium-Info", """

""")


def Einsteinium():

    tkMessageBox.showinfo("Einsteinium-Info", """

""")


def Fermium():

    tkMessageBox.showinfo("Fermium-Info", """

""")


def Mendelevium():

    tkMessageBox.showinfo("Mendelevium-Info", """

""")


def Nobelium():

    tkMessageBox.showinfo("Nobelium-Info", """

""")


def Lawrencium():

    tkMessageBox.showinfo("Lawrencium-Info", """

""")


def Rutherfordium():

    tkMessageBox.showinfo("Rutherfordium-Info", """

""")


def Dubnium():

    tkMessageBox.showinfo("Dubnium-Info", """

""")


def Seaborgium():

    tkMessageBox.showinfo("Seaborgium-Info", """

""")


def Bohrium():

    tkMessageBox.showinfo("Bohrium-Info", """

""")


def Hassium():

    tkMessageBox.showinfo("Hassium-Info", """

""")


def Meitnerium():

    tkMessageBox.showinfo("Meitnerium-Info", """

""")


def Darmstadtium():

    tkMessageBox.showinfo("Darmstadtium-Info", """

""")


def Roentgenium():

    tkMessageBox.showinfo("Roentgenium-Info", """

""")


def Copernicium():

    tkeMessageBox.showinfo("Copernicium-Info", """

""")


def About():

    tkMessageBox.showinfo("Info", """

PeriodicTableGUI

Written in Python 2.7

Uses the .grid() function of Tkinter

------------------------

I am pretty sure

all of the information

is accurate, but there

may be some details I

got wrong.

-----------------------

So sue me.

""")


def Credits():

    tkMessageBox.showinfo("About", """

Coded by:

Nicholas Alaniz

2011

""")



#Drawing graphic

    #NOTE: The grid placement line was moved here for neatness and easy editing

Graphic = Canvas(top, height=68, width=320)

Graphic.create_text(150, 20, font = Times, text = "Periodic Table of the Elements")

Graphic.grid(column=6, row=1, columnspan=7, rowspan=3)


#Building all of the button widgets

About = Tkinter.Button(top, text = "About", command = About)

Credits = Tkinter.Button(top, text = "Credits", command = Credits)

H = Tkinter.Button(top, text = "1-H", command = Hydrogen, width=6, relief=GROOVE, overrelief=RAISED, bg="blue")

He = Tkinter.Button(top, text = "2-He", command = Helium, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

Li = Tkinter.Button(top, text = "3-Li", command = Lithium, width=6, relief=GROOVE, overrelief=RAISED, bg="blue")

Be = Tkinter.Button(top, text = "4-Be", command = Beryllium, width=6, relief=GROOVE, overrelief=RAISED, bg="blue")

B = Tkinter.Button(top, text = "5-B", command = Boron, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

C = Tkinter.Button(top, text = "6-C", command = Carbon, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

N = Tkinter.Button(top, text = "7-N", command = Nitrogen, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

O = Tkinter.Button(top, text = "8-O", command = Oxygen, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

F = Tkinter.Button(top, text = "9-F", command = Flourine, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

Ne = Tkinter.Button(top, text = "10-Ne", command = Neon, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

Na = Tkinter.Button(top, text = "11-Na", command = Sodium, width=6, relief=GROOVE, overrelief=RAISED, bg="blue")

Mg = Tkinter.Button(top, text = "12-Mg", command = Magnesium, width=6, relief=GROOVE, overrelief=RAISED, bg="blue")

Al = Tkinter.Button(top, text = "13-Al", command = Aluminum, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

Si = Tkinter.Button(top, text = "14-Si", command = Silicon, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

P = Tkinter.Button(top, text = "15-P", command = Phosphorus, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

S = Tkinter.Button(top, text = "16-S", command = Sulfur, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

Cl = Tkinter.Button(top, text = "17-Cl", command = Chlorine, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

Ar = Tkinter.Button(top, text = "18-Ar", command = Argon, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

K = Tkinter.Button(top, text = "19-K", command = Potassium, width=6, relief=GROOVE, overrelief=RAISED, bg="blue")

Ca = Tkinter.Button(top, text = "20-Ca", command = Calcium, width=6, relief=GROOVE, overrelief=RAISED, bg="blue")

Sc = Tkinter.Button(top, text = "21-Sc", command = Scandium, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Ti = Tkinter.Button(top, text = "22-Ti", command = Titanium, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

V = Tkinter.Button(top, text = "23-V", command = Vanadium, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Cr = Tkinter.Button(top, text = "24-Cr", command = Chromium, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Mn = Tkinter.Button(top, text = "25-Mn", command = Managnese, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Fe = Tkinter.Button(top, text = "26-Fe", command = Iron, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Co = Tkinter.Button(top, text = "27-Co", command = Cobalt, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Ni = Tkinter.Button(top, text = "28-Ni", command = Nickel, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Cu = Tkinter.Button(top, text = "29-Cu", command = Copper, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Zn = Tkinter.Button(top, text = "30-Zn", command = Zinc, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Ga = Tkinter.Button(top, text = "31-Ga", command = Gallium, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

Ge = Tkinter.Button(top, text = "32-Ge", command = Germanium, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

As = Tkinter.Button(top, text = "33-As", command = Arsenic, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

Se = Tkinter.Button(top, text = "34-Se", command = Selenium, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

Br = Tkinter.Button(top, text = "35-Br", command = Bromine, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

Kr = Tkinter.Button(top, text = "36-Kr", command = Krypton, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

Rb = Tkinter.Button(top, text = "37-Rb", command = Rubidium, width=6, relief=GROOVE, overrelief=RAISED, bg="blue")

Sr = Tkinter.Button(top, text = "38-Sr", command = Strontium, width=6, relief=GROOVE, overrelief=RAISED, bg="blue")

Y = Tkinter.Button(top, text = "39-Y", command = Yttrium, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Zr = Tkinter.Button(top, text = "40-Zr", command = Zirconium, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Nb = Tkinter.Button(top, text = "41-Nb", command = Niobium, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Mo = Tkinter.Button(top, text = "42-Mo", command = Molybdenum, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Tc = Tkinter.Button(top, text = "43-Tc", command = Technetium, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Ru = Tkinter.Button(top, text = "44-Ru", command = Ruthenium, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Rh = Tkinter.Button(top, text = "45-Rh", command = Rhodium, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Pd = Tkinter.Button(top, text = "46-Pd", command = Palladium, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Ag = Tkinter.Button(top, text = "47-Ag", command = Silver, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Cd = Tkinter.Button(top, text = "48-Cd", command = Cadmium, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

In = Tkinter.Button(top, text = "49-In", command = Indium, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

Sn = Tkinter.Button(top, text = "50-Sn", command = Tin, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

Sb = Tkinter.Button(top, text = "51-Sb", command = Antimony, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

Te = Tkinter.Button(top, text = "52-Te", command = Tellurium, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

I = Tkinter.Button(top, text = "53-I", command = Iodine, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

Xe = Tkinter.Button(top, text = "54-Xe", command = Xenon, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

Cs = Tkinter.Button(top, text = "55-Cs", command = Cesium, width=6, relief=GROOVE, overrelief=RAISED, bg="blue")

Ba = Tkinter.Button(top, text = "56-Ba", command = Barium, width=6, relief=GROOVE, overrelief=RAISED, bg="blue")

La = Tkinter.Button(top, text = "57-La", command = Lanthanum, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

Ce = Tkinter.Button(top, text = "58-Ce", command = Cerium, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

Pr = Tkinter.Button(top, text = "59-Pr", command = Praseodymium, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

Nd = Tkinter.Button(top, text = "60-Nd", command = Neodymium, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

Pm = Tkinter.Button(top, text = "61-Pm", command = Promethium, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

Sm = Tkinter.Button(top, text = "62-Am", command = Samarium, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

Eu = Tkinter.Button(top, text = "63-Eu", command = Europium, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

Gd = Tkinter.Button(top, text = "64-Gd", command = Gadolinium, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

Tb = Tkinter.Button(top, text = "65-Tb", command = Terbium, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

Dy = Tkinter.Button(top, text = "66-Dy", command = Dysporsium, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

Ho = Tkinter.Button(top, text = "67-Ho", command = Holmium, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

Er = Tkinter.Button(top, text = "68-Er", command = Erbium, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

Tm = Tkinter.Button(top, text = "69-Tm", command = Thulium, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

Yb = Tkinter.Button(top, text = "70-Yb", command = Ytterbium, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

Lu = Tkinter.Button(top, text = "71-Lu", command = Lutetium, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Hf = Tkinter.Button(top, text = "72-Hf", command = Hafnium, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Ta = Tkinter.Button(top, text = "73-Ta", command = Tantalum, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

W = Tkinter.Button(top, text = "74-W", command = Tungsten, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Re = Tkinter.Button(top, text = "75-Re", command = Rhenium, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Os = Tkinter.Button(top, text = "76-Os", command = Osmium, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Ir = Tkinter.Button(top, text = "77-Ir", command = Iridium, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Pt = Tkinter.Button(top, text = "78-Pt", command = Platinum, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Au = Tkinter.Button(top, text = "79-Au", command = Gold, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Hg = Tkinter.Button(top, text = "80-Hg", command = Mercury, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Tl = Tkinter.Button(top, text = "81-Tl", command = Thallium, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

Pb = Tkinter.Button(top, text = "82-Pb", command = Lead, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

Bi = Tkinter.Button(top, text = "83-Bi", command = Bismuth, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

Po = Tkinter.Button(top, text = "84-Po", command = Polonium, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

At = Tkinter.Button(top, text = "85-At", command = Astatine, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

Rn = Tkinter.Button(top, text = "86-Rn", command = Radon, width=6, relief=GROOVE, overrelief=RAISED, bg="yellow")

Fr = Tkinter.Button(top, text = "87-Fr", command = Francium, width=6, relief=GROOVE, overrelief=RAISED, bg="blue")

Ra = Tkinter.Button(top, text = "88-Ra", command = Radium, width=6, relief=GROOVE, overrelief=RAISED, bg="blue")

Ac = Tkinter.Button(top, text = "89-Ac", command = Actinium, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

Th = Tkinter.Button(top, text = "90-Th", command = Thorium, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

Pa = Tkinter.Button(top, text = "91-Pa", command = Protactinium, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

U = Tkinter.Button(top, text = "92-U", command = Uranium, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

Np = Tkinter.Button(top, text = "93-Np", command = Neptunium, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

Pu = Tkinter.Button(top, text = "94-Pu", command = Plutonium, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

Am = Tkinter.Button(top, text = "95-Am", command = Americium, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

Cm = Tkinter.Button(top, text = "96-Cm", command = Curium, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

Bk = Tkinter.Button(top, text = "97-Bk", command = Berkelium, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

Cf = Tkinter.Button(top, text = "98-Cf", command = Californium, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

Es = Tkinter.Button(top, text = "99-Es", command = Einsteinium, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

Fm = Tkinter.Button(top, text = "100-Fm", command = Fermium, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

Md = Tkinter.Button(top, text = "101-Md", command = Mendelevium, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

No = Tkinter.Button(top, text = "102-No", command = Nobelium, width=6, relief=GROOVE, overrelief=RAISED, bg="green")

Lr = Tkinter.Button(top, text = "103-Lr", command = Lawrencium, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Rf = Tkinter.Button(top, text = "104-Rf", command = Rutherfordium, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Db = Tkinter.Button(top, text = "105-Db", command = Dubnium, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Sg = Tkinter.Button(top, text = "106-Sg", command = Seaborgium, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Bh = Tkinter.Button(top, text = "107-Bh", command = Bohrium, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Hs = Tkinter.Button(top, text = "108-Hs", command = Hassium, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Mt = Tkinter.Button(top, text = "109-Mt", command = Meitnerium, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Ds = Tkinter.Button(top, text = "110-Ds", command = Darmstadtium, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Rg = Tkinter.Button(top, text = "111-Rg", command = Roentgenium, width=6, relief=GROOVE, overrelief=RAISED, bg="red")

Cn = Tkinter.Button(top, text = "112-Cn", command = Copernicium, width=6, relief=GROOVE, overrelief=RAISED, bg="red")


#Start placing buttons on the grid

About.grid(column=4, row=2)

Credits.grid(column=5, row=2)

H.grid(column=1, row=1)

He.grid(column=18, row=1)

Li.grid(column=1, row=2)

Be.grid(column=2, row=2)

B.grid(column=13, row=2)

C.grid(column=14, row=2)

N.grid(column=15, row=2)

O.grid(column=16, row=2)

F.grid(column=17, row=2)

Ne.grid(column=18, row=2)

Na.grid(column=1, row=3)

Mg.grid(column=2, row=3)

Al.grid(column=13, row=3)

Si.grid(column=14, row=3)

P.grid(column=15, row=3)

S.grid(column=16, row=3)

Cl.grid(column=17, row=3)

Ar.grid(column=18, row=3)

K.grid(column=1, row=4)

Ca.grid(column=2, row=4)

Sc.grid(column=3, row=4)

Ti.grid(column=4, row=4)

V.grid(column=5, row=4)

Cr.grid(column=6, row=4)

Mn.grid(column=7, row=4)

Fe.grid(column=8, row=4)

Co.grid(column=9, row=4)

Ni.grid(column=10, row=4)

Cu.grid(column=11, row=4)

Zn.grid(column=12, row=4)

Ga.grid(column=13, row=4)

Ge.grid(column=14, row=4)

As.grid(column=15, row=4)

Se.grid(column=16, row=4)

Br.grid(column=17, row=4)

Kr.grid(column=18, row=4)

Rb.grid(column=1, row=5)

Sr.grid(column=2, row=5)

Y.grid(column=3, row=5)

Zr.grid(column=4, row=5)

Nb.grid(column=5, row=5)

Mo.grid(column=6, row=5)

Tc.grid(column=7, row=5)

Ru.grid(column=8, row=5)

Rh.grid(column=9, row=5)

Pd.grid(column=10, row=5)

Ag.grid(column=11, row=5)

Cd.grid(column=12, row=5)

In.grid(column=13, row=5)

Sn.grid(column=14, row=5)

Sb.grid(column=15, row=5)

Te.grid(column=16, row=5)

I.grid(column=17, row=5)

Xe.grid(column=18, row=5)

Cs.grid(column=1, row=6)

Ba.grid(column=2, row=6)

La.grid(column=3, row=9)

Ce.grid(column=4, row=9)

Pr.grid(column=5, row=9)

Nd.grid(column=6, row=9)

Pm.grid(column=7, row=9)

Sm.grid(column=8, row=9)

Eu.grid(column=9, row=9)

Gd.grid(column=10, row=9)

Tb.grid(column=11, row=9)

Dy.grid(column=12, row=9)

Ho.grid(column=13, row=9)

Er.grid(column=14, row=9)

Tm.grid(column=15, row=9)

Yb.grid(column=16, row=9)

Lu.grid(column=3, row=6)

Hf.grid(column=4, row=6)

Ta.grid(column=5, row=6)

W.grid(column=6, row=6)

Re.grid(column=7, row=6)

Os.grid(column=8, row=6)

Ir.grid(column=9, row=6)

Pt.grid(column=10, row=6)

Au.grid(column=11, row=6)

Hg.grid(column=12, row=6)

Tl.grid(column=13, row=6)

Pb.grid(column=14, row=6)

Bi.grid(column=15, row=6)

Po.grid(column=16, row=6)

At.grid(column=17, row=6)

Rn.grid(column=18, row=6)

Fr.grid(column=1, row=7)

Ra.grid(column=2, row=7)

Ac.grid(column=3, row=10)

Th.grid(column=4, row=10)

Pa.grid(column=5, row=10)

U.grid(column=6, row=10)

Np.grid(column=7, row=10)

Pu.grid(column=8, row=10)

Am.grid(column=9, row=10)

Cm.grid(column=10, row=10)

Bk.grid(column=11, row=10)

Cf.grid(column=12, row=10)

Es.grid(column=13, row=10)

Fm.grid(column=14, row=10)

Md.grid(column=15, row=10)

No.grid(column=16, row=10)

Lr.grid(column=3, row=7)

Rf.grid(column=4, row=7)

Db.grid(column=5, row=7)

Sg.grid(column=6, row=7)

Bh.grid(column=7, row=7)

Hs.grid(column=8, row=7)

Mt.grid(column=9, row=7)

Ds.grid(column=10, row=7)

Rg.grid(column=11, row=7)

Cn.grid(column=12, row=7)


#Start window loop

top.mainloop()


Edited by Waffles, 23 January 2011 - 02:35 PM.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users