Updated Todo list
This commit is contained in:
Binary file not shown.
@@ -23,6 +23,9 @@ texts.append(createText(font, 'Pressure (PSI)', positions[0]))
|
|||||||
texts.append(createText(font, 'Heart Rate (BPM)', positions[1]))
|
texts.append(createText(font, 'Heart Rate (BPM)', positions[1]))
|
||||||
texts.append(createText(font, '0', positions[2]))
|
texts.append(createText(font, '0', positions[2]))
|
||||||
texts.append(createText(font, '0', positions[3]))
|
texts.append(createText(font, '0', positions[3]))
|
||||||
|
def test(nothing):
|
||||||
|
return
|
||||||
|
testButton = Button([10,10], [50,50], pygame, test, "Hello")
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
done = False
|
done = False
|
||||||
@@ -42,12 +45,12 @@ def main():
|
|||||||
class Button:
|
class Button:
|
||||||
pos = [0,0]
|
pos = [0,0]
|
||||||
size = [0,0]
|
size = [0,0]
|
||||||
def __init__(self, position, size, pygame, function, arguments):
|
def __init__(self, position, size, pygame, function, argument):
|
||||||
self.pygame = pygame
|
|
||||||
self.pos = position
|
self.pos = position
|
||||||
self.size = size
|
self.size = size
|
||||||
self.function = function
|
self.function = function
|
||||||
self.arguments = arguments
|
self.argument = argument
|
||||||
|
self.pygame = pygame
|
||||||
return
|
return
|
||||||
|
|
||||||
def isClicked(self):
|
def isClicked(self):
|
||||||
@@ -55,9 +58,17 @@ class Button:
|
|||||||
if x >= self.pos[0] and x <= self.pos[0]+self.size[0]:
|
if x >= self.pos[0] and x <= self.pos[0]+self.size[0]:
|
||||||
if y >= self.pos[1] and y <= self.pos[1]+self.size[1]:
|
if y >= self.pos[1] and y <= self.pos[1]+self.size[1]:
|
||||||
if pygame.mouse.get_pressed()[0] == True:
|
if pygame.mouse.get_pressed()[0] == True:
|
||||||
self.function(self.arguments)
|
self.function(self.argument)
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def setPosition(self, x, y):
|
||||||
|
self.pos[0], self.pos[1] = x, y
|
||||||
|
return
|
||||||
|
|
||||||
|
def setArgument(self, argument):
|
||||||
|
self.argument = argument
|
||||||
|
return
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user