Created
July 17, 2017 11:55
-
-
Save Exodus111/756d3ae7fa0da5bbbcbf72199f4df312 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#: 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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