Skip to content

Instantly share code, notes, and snippets.

@spiridonovpolytechnic
Created November 17, 2016 02:32
Show Gist options
  • Save spiridonovpolytechnic/9465232695a2c071d61a5838fddf2bd9 to your computer and use it in GitHub Desktop.
Save spiridonovpolytechnic/9465232695a2c071d61a5838fddf2bd9 to your computer and use it in GitHub Desktop.
Simple counter display, increment, reset kivy app.
class MyApp(App):
def __init__(self,dictionary):
App.__init__(self)
self.dict_local = dictionary
def build(self):
layout1 = BoxLayout(orientation='horizontal',spacing=10)
layout1.add_widget(LabelD(self.dict_local,'counter',font_size=200))
layout2 = BoxLayout(orientation='vertical', spacing=10)
layout2.add_widget(ButtonDIPO(self.dict_local,'counter',operator.add,1,text="+1",font_size=200))
layout2.add_widget(ButtonDIPO(self.dict_local, 'counter', operator.mul, 0, text="Reset",font_size=200))
layout1.add_widget(layout2)
return layout1
if __name__ == '__main__':
dict_global = {}
dict_global['counter'] = 0
app = MyApp(dict_global)
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment