''' Created on Apr 17, 2014 @author: Brett Paufler Copyright Brett Paufler Kivy App Kivy is not loaded In CBU-Installed, please find Kivy-1.8.0-py2.7-win32kivy.zip unzip drop this naked .py file on kivy.bat in first directly program should run unzip drop this naked .py file on This loads a 10x10 grid of buttons press one button then another and half the value of the first button is transferred to the second this is as far as I got on this game implementation do you remember this game? In all honestly, this was almost two years ago (as of this writing in 2016) you are such a better programmer in 2016 than you were in 2014 how much better are you now this is scrap but for whatever reason, you have a fondness for this particular class of scrap ''' import kivy from kivy.app import App from kivy.uix.button import Button from kivy.uix.widget import Widget from kivy.uix.gridlayout import GridLayout import math class GameButton(Button): def __init__(self): super(GameButton, self).__init__() self.val = 10 self.row = 0 self.column = 0 class MyApp(App): def build(self): b = [] gameRows = 10 gameColumns = 10 defaultStartValue = 100 global firstPush firstPush = True global firstButton parent = GridLayout(rows=gameRows, cols=gameColumns) def buttonPush(button): global firstPush global firstButton print "button.val = " + str(button.val) if firstPush: firstPush = False firstButton = button else: firstPush = True if firstButton == button: print "Buttons are the same" print button.val print int(button.val) print int(button.val) * 1.5 print math.floor(int(button.val) * 1.5) print int(math.floor(int(button.val) * 1.5)) print str(int(math.ceil(int(button.val) * 1.5))) if button.val == "1": button.val = "2" else: button.val = str(int(math.floor(int(button.val) * 1.5))) print "Button Text" print button.val #button.text = str(button.val) else: print "buttons are different" print "pre Change firstButton.val = " + str(firstButton.val) print "pre Change Second Button.val = " + str(button.val) transfer = int(math.floor(int(firstButton.val) / 2)) print "transfer = " + str(transfer) firstButton.val = int(firstButton.val) - transfer button.val = int(button.val) + transfer print "post Change firstButton.val = " + str(firstButton.val) print "post change secondButton.val = " + str(button.val) print "post Transfer = " + str(transfer) #button.text = str(button.val) button.text = str(button.val) firstButton.text = str(firstButton.val) #defaultStartValue += 1 ''' print button print button.text button.text = str(int(button.text) + 1) print "Yeah, it's a button" ''' for r in range(0,gameRows,1): b.append([]) print b[r] for c in range (0,gameColumns,1): #Text probabluy won't work #bT = "Button #" + str(r) + "-" + str(c) + "\n\nGood To Go\n\nTroops Equals\n\n" + str(x) bT = str(defaultStartValue) b[r].append(GameButton()) b[r][c].text = bT b[r][c].halign='center' b[r][c].row = r b[r][c].col = c b[r][c].val = defaultStartValue parent.add_widget(b[r][c]) b[r][c].bind(on_release=buttonPush) return parent if __name__ == '__main__': MyApp().run() print "EXIT ALL"