Skip to content

Instantly share code, notes, and snippets.

@Exodus111
Created July 17, 2017 11:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Exodus111/756d3ae7fa0da5bbbcbf72199f4df312 to your computer and use it in GitHub Desktop.
Save Exodus111/756d3ae7fa0da5bbbcbf72199f4df312 to your computer and use it in GitHub Desktop.
#: kivy 1.9.1
<Main>:
HUD:
size_hint: 1., 1.
pos: 0,0
<HUD>:
spacing: 10
Button:
text: "Press here"
pos_hint: {"x": 0, "top": 1}
size_hint: .2, .2
on_press: root.button_pressed
#!/usr/bin/python3
from kivy.app import App
from kivy.clock import Clock
from kivy.uix.widget import Widget
from kivy.uix.floatlayout import FloatLayout
from kivy.properties import *
class HUD(FloatLayout):
def setup(self):
pass
def update(self, dt):
pass
def button_pressed(self, *e):
print("Testing Button Press")
class Main(Widget):
def setup(self):
for child in self.children:
child.setup()
def update(self, dt):
for child in self.children:
child.update(dt)
class MainApp(App):
def build(self):
main = Main()
main.setup()
Clock.schedule_interval(main.update, 1./60.)
return main
if __name__ == "__main__":
MainApp().run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment