Updated Todo list
This commit is contained in:
@@ -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, '0', positions[2]))
|
||||
texts.append(createText(font, '0', positions[3]))
|
||||
def test(nothing):
|
||||
return
|
||||
testButton = Button([10,10], [50,50], pygame, test, "Hello")
|
||||
|
||||
def main():
|
||||
done = False
|
||||
@@ -42,12 +45,12 @@ def main():
|
||||
class Button:
|
||||
pos = [0,0]
|
||||
size = [0,0]
|
||||
def __init__(self, position, size, pygame, function, arguments):
|
||||
self.pygame = pygame
|
||||
def __init__(self, position, size, pygame, function, argument):
|
||||
self.pos = position
|
||||
self.size = size
|
||||
self.function = function
|
||||
self.arguments = arguments
|
||||
self.argument = argument
|
||||
self.pygame = pygame
|
||||
return
|
||||
|
||||
def isClicked(self):
|
||||
@@ -55,9 +58,17 @@ class Button:
|
||||
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 pygame.mouse.get_pressed()[0] == True:
|
||||
self.function(self.arguments)
|
||||
self.function(self.argument)
|
||||
return True
|
||||
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__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user