#!/usr/bin/python from PythonCardPrototype import model class Counter(model.Background): def on_menuFileExit_select(self, event): self.Close() def calculate(self): max(self.One, self.Two) def on_Button1_mouseClick(self, event): self.One = self.components.tax1.value*self.components.wtax.value + self.components.education1.value*self.components.weducation.value + self.components.foreign1.value*self.components.wforeign.value + self.components.social1.value*self.components.wsocial.value + self.components.intel1.value*self.components.wintel.value + self.components.char1.value*self.components.wchar.value + self.components.lead1.value*self.components.wlead.value self.Two = self.components.tax2.value*self.components.wtax.value + self.components.education2.value*self.components.weducation.value + self.components.foreign2.value*self.components.wforeign.value + self.components.social2.value*self.components.wsocial.value + self.components.intel2.value*self.components.wintel.value + self.components.char2.value*self.components.wchar.value + self.components.lead2.value*self.components.wlead.value self.winner = max(self.One, self.Two) if self.winner == self.One: self.components.field1.text = "Candidate One is the choice for you!" if self.winner == self.Two: self.components.field1.text = "Candidate Two is the choice for you!" if __name__ == '__main__': app = model.PythonCardApp(Counter) app.MainLoop()