#!/usr/bin/python from PythonCardPrototype import model class Counter(model.Background): def on_menuFileExit_select(self, event): self.Close() def calculate(self): max(self.Python, self.Perl, self.Ruby, self.Javascript) def on_Button1_mouseClick(self, event): self.Python = self.components.easelearning.value*10 + self.components.easeuse.value*10 + self.components.server.value*5 + self.components.pop.value*6 + self.components.graphics.value*10 + self.components.read.value*10 + self.components.obj.value*8 self.Perl = self.components.easelearning.value*6 + self.components.easeuse.value*8 + self.components.server.value*10 + self.components.pop.value*10 + self.components.graphics.value*10 + self.components.read.value*3 + self.components.obj.value*3 self.Ruby = self.components.easelearning.value*5 + self.components.easeuse.value*8 + self.components.server.value*4 + self.components.pop.value*2 + self.components.graphics.value*9 + self.components.read.value*7 + self.components.obj.value*10 self.Javascript = self.components.easelearning.value*9 + self.components.easeuse.value*8 + self.components.client.value*10 + self.components.pop.value*6 + self.components.read.value*6 + self.components.obj.value*8 self.winner = max(self.Python, self.Perl, self.Ruby, self.Javascript) if self.winner == self.Python: self.components.field1.text = "Python is the language for you!" if self.winner == self.Perl: self.components.field1.text = "Perl is the language for you!" if self.winner == self.Ruby: self.components.field1.text = "Ruby is the language for you!" if self.winner == self.Javascript: self.components.field1.text = "Javascript is the language for you!" self.components.python.text = str(self.Python) self.components.perl.text = str(self.Perl) self.components.ruby.text = str(self.Ruby) self.components.javascript.text = str(self.Javascript) if __name__ == '__main__': app = model.PythonCardApp(Counter) app.MainLoop()