Beispiel #1
0
    def OnAdd(self, event):
        if not self.tc1.GetValue() or not self.tc2.GetValue() or not self.tc3.GetValue():
            return

        self.tc4.Clear()
        self.tc5.Clear()
        markmid = int(self.tc1.GetValue())
        upphaed = int(self.tc2.GetValue())
        vextir = float(self.tc3.GetValue())
        nidurstada = reiknivelar.sparnadar_timi(markmid, upphaed, vextir)
        
        if nidurstada == None:
            ar = 'Villa'
            man = 'Villa'
            self.tc4.SetForegroundColour(wx.RED)
            self.tc5.SetForegroundColour(wx.RED)
        else:
            self.tc4.SetForegroundColour(wx.BLACK)
            self.tc5.SetForegroundColour(wx.BLACK)
            ar = reiknivelar.sparnadar_timi(markmid, upphaed, vextir)[0]
            man = reiknivelar.sparnadar_timi(markmid, upphaed, vextir)[1]
            ar = int(ar)
            man = int(man)
        self.tc4.AppendText(str(ar))
        self.tc5.AppendText(str(man))
 def testTwo_sparnadar_timi(self):
     self.failUnlessAlmostEqual(reiknivelar.sparnadar_timi(100000000, 1000, 34), (23, 9.0), places = 1)
 def testOne_sparnadar_timi(self):
     self.failUnlessAlmostEqual(reiknivelar.sparnadar_timi(100000, 520, 3), (13, 2.0), places = 1)