def get_combinations(self, n, k):
     tk.Label(self.master, text="", width="30").grid(row=4, column=2)
     if (checkFloat(n) and checkFloat(k)):
         result = choose(n, k)
         tk.Label(self.master, text=result).grid(row=4, column=2)
     else:
         tk.Label(self.master, text="Only Numbers Allowed").grid(row=4,
                                                                 column=2)
Ejemplo n.º 2
0
 def calculate_pythagorean(self, a, b):
     tk.Label(self.master, text="", width="15").grid(row=4, column=0)
     tk.Label(self.master, text="", width="15").grid(row=4, column=1)
     tk.Label(self.master, text="", width="15").grid(row=4, column=2)
     if (checkFloat(a) and checkFloat(b)):
         c = math.sqrt(((float(a)**2) + (float(b)**2)))
         tk.Label(self.master, text="c:").grid(row=4, column=0)
         tk.Label(self.master, text=c).grid(row=4, column=2)
     else:
         tk.Label(self.master, text="Enter Valid Values").grid(row=4,
                                                               column=1)
    def get_percent(self, e1, e2):
        tk.Label(self.master, text="", width="30").grid(row=4, column=4)
        tk.Label(self.master, text="", width="30").grid(row=5, column=3)
        if (checkFloat(e1.get()) and checkFloat(e2.get())):
            result = str(float(e1.get()) / float(e2.get()) * 100.0) + "%"
            result = shortenFloat(result, 5)
            tk.Label(self.master, text=result).grid(row=4, column=4)

        else:
            tk.Label(self.master, text="Only Numbers Allowed").grid(row=5,
                                                                    column=3)
Ejemplo n.º 4
0
 def calculate_distance_between(self, x1, y1, x2, y2):
     tk.Label(self.master, text="", width="20").grid(row=6, column=1)
     if (checkFloat(x1) and checkFloat(y1) and checkFloat(x2)
             and checkFloat(y2)):
         x1, y1, x2, y2 = float(x1), float(y1), float(x2), float(y2)
         distance = abs(math.sqrt(((x2 - x1)**2) + ((y2 - y1)**2)))
         tk.Label(self.master, text=str(shortenFloat(distance,
                                                     6))).grid(row=6,
                                                               column=1)
     else:
         tk.Label(self.master, text="Enter Valid Values").grid(row=6,
                                                               column=1)
Ejemplo n.º 5
0
 def calculate_grams_to_moles(self, mm, mass, moles):
     tk.Label(self.master, text="", width="30").grid(row=6, column=1)
     tk.Label(self.master, text="", width="15").grid(row=5, column=0)
     tk.Label(self.master, text="", width="15").grid(row=5, column=2)
     if (mm == "" or not checkFloat(mm)):
         tk.Label(self.master, text="Enter Valid Values").grid(row=4,
                                                               column=1)
     elif (checkFloat(mass)):
         moles = float(mass) / float(mm)
         tk.Label(self.master, text="Moles: ").grid(row=5, column=0)
         tk.Label(self.master, text=moles).grid(row=5, column=2)
     elif (checkFloat(moles)):
         mass = float(moles) * float(mm)
         tk.Label(self.master, text="Mass: ").grid(row=5, column=0)
         tk.Label(self.master, text=mass).grid(row=5, column=2)
     else:
         tk.Label(self.master, text="Enter Valid Values").grid(row=6,
                                                               column=1)
Ejemplo n.º 6
0
 def calculate_sphere_volume(self, r):
     tk.Label(self.master, text="", width="20").grid(row=3, column=1)
     if (checkFloat(r)):
         volume = (4 / 3) * math.pi * (float(r)**3)
         tk.Label(self.master, text=str(shortenFloat(volume,
                                                     8))).grid(row=3,
                                                               column=1)
     else:
         tk.Label(self.master, text="Enter Valid Value").grid(row=3,
                                                              column=1)
Ejemplo n.º 7
0
 def calculate_cube_area(self, a):
     tk.Label(self.master, text="", width=20).grid(row=3, column=1)
     if (checkFloat(a)):
         area = 6 * (float(a)**2)
         tk.Label(self.master, text=str(shortenFloat(area,
                                                     7))).grid(row=3,
                                                               column=1)
     else:
         tk.Label(self.master, text="Enter Valid Value").grid(row=3,
                                                              column=1)
 def get_doubling_time(self, e1):
     tk.Label(self.master, text="", width="30").grid(row=4, column=2)
     tk.Label(self.master, text="", width="30").grid(row=3, column=2)
     if (checkFloat(e1.get())):
         if (float(e1.get()) == 0):
             tk.Label(self.master, text="Infinity").grid(row=3, column=2)
             return
         result = float(np.log(2.0)) / float(
             np.log(1.0 + (float(e1.get()) / 100.0)))
         result = shortenFloat(result, 5)
         tk.Label(self.master, text=result).grid(row=3, column=2)
     else:
         tk.Label(self.master, text="Only Numbers Allowed").grid(row=4,
                                                                 column=2)
Ejemplo n.º 9
0
 def calculate_molality(self, moles, mass, molality):
     tk.Label(self.master, text="", width="30").grid(row=6, column=1)
     tk.Label(self.master, text="", width="15").grid(row=5, column=0)
     tk.Label(self.master, text="", width="15").grid(row=5, column=2)
     if (checkFloat(moles) and checkFloat(mass)):
         molality = float(moles) / float(mass)
         tk.Label(self.master, text="Molality: ").grid(row=5, column=0)
         tk.Label(self.master, text=molality).grid(row=5, column=2)
     elif (checkFloat(moles) and checkFloat(molality)):
         mass = float(moles) / float(molality)
         tk.Label(self.master, text="Mass: ").grid(row=5, column=0)
         tk.Label(self.master, text=mass).grid(row=5, column=2)
     elif (checkFloat(molality) and checkFloat(mass)):
         moles = float(mass) * float(molality)
         tk.Label(self.master, text="Moles: ").grid(row=5, column=0)
         tk.Label(self.master, text=moles).grid(row=5, column=2)
     else:
         tk.Label(self.master, text="Enter Valid Values").grid(row=6,
                                                               column=1)
Ejemplo n.º 10
0
 def calculate_percent_yield(self, theoretical, actual, percent):
     tk.Label(self.master, text="", width="30").grid(row=6, column=1)
     tk.Label(self.master, text="", width="15").grid(row=5, column=0)
     tk.Label(self.master, text="", width="15").grid(row=5, column=2)
     if (checkFloat(theoretical) and checkFloat(actual)):
         percent = (float(actual) / float(theoretical)) * 100
         tk.Label(self.master, text="Percent Yield: ").grid(row=5, column=0)
         tk.Label(self.master,
                  text=str(shortenFloat(percent, 5)) + "%").grid(row=5,
                                                                 column=2)
     elif (checkFloat(theoretical) and checkFloat(percent)):
         actual = float(theoretical) * (float(percent) / 100)
         tk.Label(self.master, text="Actual: ").grid(row=5, column=0)
         tk.Label(self.master, text=actual).grid(row=5, column=2)
     elif (checkFloat(actual) and checkFloat(percent)):
         theoretical = float(actual) / (float(percent) / 100)
         tk.Label(self.master, text="Theoretical: ").grid(row=5, column=0)
         tk.Label(self.master, text=theoretical).grid(row=5, column=2)
     else:
         tk.Label(self.master, text="Enter Valid Values").grid(row=6,
                                                               column=1)
Ejemplo n.º 11
0
 def calculate_ppm_to_molarity(self, ppm, mm, M):
     tk.Label(self.master, text="", width="30").grid(row=6, column=1)
     tk.Label(self.master, text="", width="15").grid(row=5, column=0)
     tk.Label(self.master, text="", width="15").grid(row=5, column=2)
     if (checkFloat(ppm) and checkFloat(mm)):
         M = (float(ppm) / 1000) / float(mm)
         tk.Label(self.master, text="Molarity: ").grid(row=5, column=0)
         tk.Label(self.master, text=shortenFloat(M, 6)).grid(row=5,
                                                             column=2)
     elif (checkFloat(ppm) and checkFloat(M)):
         mm = (float(ppm) / 1000) / float(M)
         tk.Label(self.master, text="Molar Mass: ").grid(row=5, column=0)
         tk.Label(self.master, text=shortenFloat(mm, 6)).grid(row=5,
                                                              column=2)
     elif (checkFloat(mm) and checkFloat(M)):
         ppm = (float(mm) * float(M)) * 1000
         tk.Label(self.master, text="PPM: ").grid(row=5, column=0)
         tk.Label(self.master, text=shortenFloat(ppm, 6)).grid(row=5,
                                                               column=2)
     else:
         tk.Label(self.master, text="Enter Valid Values").grid(row=6,
                                                               column=1)