Created
June 19, 2013 23:01
-
-
Save Kovak/5818894 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
from kivy.app import App | |
from kivy.uix.textinput import TextInput | |
#from kivy.uix.floatlayout import FloatLayout | |
from kivy.uix.widget import Widget | |
#from kivy.graphics import Color, Triangle, Ellipse | |
from kivy.properties import ObjectProperty, StringProperty | |
class AlarmBox(Widget): | |
Hour_i= 0; | |
Tmin_i= 0; | |
Omin_i = 0; | |
Day_i = 0; | |
hour = ["12","1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"] | |
tensMin = ["0", "1", "2", "3", "4", "5"] | |
onesMin = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] | |
day = ["AM", "PM"] | |
txt_inpt = ObjectProperty(None) | |
hour_info = StringProperty() | |
hour_info = hour[Hour_i] | |
tmin_info = StringProperty() | |
tmin_info = tensMin[Tmin_i] | |
omin_info = StringProperty() | |
omin_info = onesMin[Omin_i] | |
day_info = StringProperty() | |
day_info = day[Day_i] | |
#increase Hour | |
def inc_hour(self): | |
self.Hour_i = self.Hour_i + 1 | |
if(self.Hour_i > 11): | |
self.Hour_i = self.Hour_i % 12 | |
self.hour_info = self.hour[self.Hour_i] | |
#decrease Hour | |
def dec_hour(self): | |
self.Hour_i = self.Hour_i - 1 | |
if(self.Hour_i < -12): | |
self.Hour_i = self.Hour_i % -12 | |
print self.Hour_i | |
self.hour_info = self.hour[self.Hour_i] | |
#increase Tens Minute | |
def inc_tmin(self): | |
self.Tmin_i = self.Tmin_i + 1 | |
if(self.Tmin_i > 5): | |
self.Tmin_i = self.Tmin_i % 6 | |
self.tmin_info = self.tensMin[self.Tmin_i] | |
#decrease Tens Minute | |
def dec_tmin(self): | |
self.Tmin_i = self.Tmin_i - 1 | |
if(self.Tmin_i < -6): | |
self.Tmin_i = self.Tmin_i % -6 | |
self.tmin_info = self.tensMin[self.Tmin_i] | |
#increase Ones Minute | |
def inc_omin(self): | |
self.Omin_i = self.Omin_i + 1 | |
if(self.Omin_i > 9): | |
self.Omin_i = self.Omin_i % 10 | |
self.omin_info = self.onesMin[self.Omin_i] | |
#decrease Ones Minute | |
def dec_omin(self): | |
self.Omin_i = self.Omin_i - 1 | |
if(self.Omin_i < -10): | |
self.Omin_i = self.Omin_i % -10 | |
self.omin_info = self.onesMin[self.Omin_i] | |
#increase AM/PM | |
def inc_day(self): | |
self.Day_i = self.Day_i + 1 | |
if(self.Day_i > 1): | |
self.Day_i = self.Day_i % 1 | |
self.day_info = self.day[self.Day_i] | |
#decrease AM/PM | |
def dec_day(self): | |
self.Day_i = self.Day_i - 1 | |
if(self.Day_i < -2): | |
self.Day_i = self.Day_i % -2 | |
self.day_info = self.day[self.Day_i] | |
class TriangleHU(Widget): | |
pass | |
class TriangleHD(Widget): | |
pass | |
class TriangleTU(Widget): | |
pass | |
class TriangleTD(Widget): | |
pass | |
class TriangleOU(Widget): | |
pass | |
class TriangleOD(Widget): | |
pass | |
class TriangleDU(Widget): | |
pass | |
class TriangleDD(Widget): | |
pass | |
class Circles(Widget): | |
pass | |
class SetAlarmApp(App): | |
def build(self): | |
top = AlarmBox() | |
return top | |
if __name__ == '__main__': | |
SetAlarmApp().run() |
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
from kivy.app import * | |
from kivy.uix.widget import Widget | |
from kivy.uix.button import Button | |
from alarm import AlarmBox | |
from kivy.lang import Builder | |
Builder.load_file('setalarm.kv') | |
class MyHomeScreen(Widget): | |
pass | |
class ButtonTest(Widget): | |
pass | |
class MyAlarmApp(App): | |
def build(self): | |
pass | |
if __name__ == '__main__': | |
MyAlarmApp().run() |
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.0.9 | |
MyHomeScreen: | |
<MyHomeScreen>: | |
BoxLayout: | |
size: 800, 600 | |
#orientation:"vertical" | |
spacing: 10 | |
on_size: print 'box_layout_size', self.size | |
AlarmBox: | |
<ButtonTest>: | |
size_hint: (1, 1) | |
Button: | |
text: "1" | |
size: root.size | |
pos: root.pos |
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.0.9 | |
<AlarmBox>: | |
FloatLayout: | |
txt_inpt: Hours_inpt, Tmin_inpt, Omin_inpt, Day_inpt | |
TextInput: | |
id: Hours_inpt | |
size_hint: None, None | |
size: 100, 100 | |
pos: 100, 250 | |
text: root.hour_info | |
TextInput: | |
id: Tmin_inpt | |
size_hint: None, None | |
size: 100, 100 | |
pos: 350, 250 | |
text: root.tmin_info | |
TextInput: | |
id: Omin_inpt | |
size_hint: None, None | |
size: 100, 100 | |
pos: 500, 250 | |
text: root.omin_info | |
TextInput: | |
id: Day_inpt | |
size_hint: None, None | |
size: 100, 100 | |
pos: 650, 250 | |
text: root.day_info | |
Button: | |
id: UpH | |
on_press: root.inc_hour(); Hours_inpt.text=root.hour_info; | |
background_color: 1,1,1,1 | |
pos: 100, 375 | |
Button: | |
id: DwnH | |
on_press: root.dec_hour(); Hours_inpt.text=root.hour_info; | |
background_color: 1,1,1,1 | |
pos: 100, 125 | |
Button: | |
id: UpTensM | |
on_press: root.inc_tmin(); Tmin_inpt.text=root.tmin_info; | |
background_color: 1,1,1,1 | |
pos: 350, 375 | |
Button: | |
id: DwnTensM | |
on_press: root.dec_tmin(); Tmin_inpt.text=root.tmin_info; | |
background_color: 1,1,1,1 | |
pos: 350, 125 | |
Button: | |
id: UpOnesM | |
on_press: root.inc_omin(); Omin_inpt.text=root.omin_info; | |
background_color: 1,1,1,1 | |
pos: 500, 375 | |
Button: | |
id: DwnOnesM | |
on_press: root.dec_omin(); Omin_inpt.text=root.omin_info; | |
background_color: 1,1,1,1 | |
pos: 500, 125 | |
Button: | |
id: UpDay | |
on_press: root.inc_day(); Day_inpt.text=root.day_info; | |
background_color: 1,1,1,1 | |
pos: 650, 375 | |
Button: | |
id: DwnDay | |
on_press: root.dec_day(); Day_inpt.text=root.day_info; | |
background_color: 1,1,1,1 | |
pos: 650, 125 | |
TriangleHU: | |
TriangleHD: | |
TriangleTU: | |
TriangleTD: | |
TriangleOU: | |
TriangleOD: | |
TriangleDU: | |
TriangleDD: | |
Circles: | |
<TriangleHU>: | |
pos: 100, 375 | |
canvas: | |
Color: | |
rgb: (1, 1, 0) | |
Triangle: | |
points: self.x, self.y, (self.x + self.width / 2), (self.y + self.height), self.x + self.width, self.y | |
<TriangleHD>: | |
pos: 100, 125 | |
canvas: | |
Color: | |
rgb: (1, 1, 0) | |
Triangle: | |
points: self.x, (self.y + self.height), (self.x + self.width / 2), self.y, self.x + self.width, (self.height + self.y) | |
<TriangleTU>: | |
pos: 350, 375 | |
canvas: | |
Color: | |
rgb: (1, 1, 0) | |
Triangle: | |
points: self.x, self.y, (self.x + self.width / 2), (self.y + self.height), self.x + self.width, self.y | |
<TriangleTD>: | |
pos: 350, 125 | |
canvas: | |
Color: | |
rgb: (1, 1, 0) | |
Triangle: | |
points: self.x, (self.y + self.height), (self.x + self.width / 2), self.y, self.x + self.width, (self.height + self.y) | |
<TriangleOU>: | |
pos: 500, 375 | |
canvas: | |
Color: | |
rgb: (1, 1, 0) | |
Triangle: | |
points: self.x, self.y, (self.x + self.width / 2), (self.y + self.height), self.x + self.width, self.y | |
<TriangleOD>: | |
pos: 500, 125 | |
canvas: | |
Color: | |
rgb: (1, 1, 0) | |
Triangle: | |
points: self.x, (self.y + self.height), (self.x + self.width / 2), self.y, self.x + self.width, (self.height + self.y) | |
<TriangleDU>: | |
pos: 650, 375 | |
canvas: | |
Color: | |
rgb: (1, 1, 0) | |
Triangle: | |
points: self.x, self.y, (self.x + self.width / 2), (self.y + self.height), self.x + self.width, self.y | |
<TriangleDD>: | |
pos: 650, 125 | |
canvas: | |
Color: | |
rgb: (1, 1, 0) | |
Triangle: | |
points: self.x, (self.y + self.height), (self.x + self.width / 2), self.y, self.x + self.width, (self.height + self.y) | |
<Circles> | |
canvas: | |
Color: | |
rgb: (255, 255, 255) | |
Ellipse: | |
size: 30, 30 | |
pos: 260, 315 | |
Ellipse: | |
size: 30, 30 | |
pos: 260, 255 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment