Last active
July 1, 2018 02:31
-
-
Save Mr-Coxall/6733777598ccb9112eb9b34de7cafd0c to your computer and use it in GitHub Desktop.
calculations.py
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
# Created by: Mr. Coxall | |
# Created on: Aug 2018 | |
# Created for: ICS3U | |
# This program does basic math | |
import ui | |
def equation1_touch_up_inside(sender): | |
# displays the answer to equation 1 | |
#view['answer1_label'].text = str(5+2^3) | |
# in python "^" is a bitwise operator and not for exponents | |
# should have used "str(5+2**3)" | |
view['answer1_label'].text = str(5+2**3) | |
def equation2_touch_up_inside(sender): | |
# displays the answer to equation 2 | |
view['answer2_label'].text = str(4/2+5) | |
def equation3_touch_up_inside(sender): | |
# displays the answer to equation 3 | |
view['answer3_label'].text = str(3+4*2) | |
def equation4_touch_up_inside(sender): | |
# displays the answer to equation 4 | |
view['answer4_label'].text = str(7-3+2) | |
view = ui.load_view() | |
view.present('full_screen') |
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
[ | |
{ | |
"selected" : false, | |
"frame" : "{{0, 0}, {1024, 768}}", | |
"class" : "View", | |
"nodes" : [ | |
{ | |
"selected" : false, | |
"frame" : "{{303, 192}, {100, 32}}", | |
"class" : "Button", | |
"nodes" : [ | |
], | |
"attributes" : { | |
"action" : "equation1_touch_up_inside", | |
"frame" : "{{472, 368}, {80, 32}}", | |
"title" : "5+2^3=", | |
"uuid" : "FD35F959-0970-4720-92AE-8564C5F5D786", | |
"class" : "Button", | |
"name" : "equation1_button", | |
"font_size" : 15 | |
} | |
}, | |
{ | |
"selected" : false, | |
"frame" : "{{303, 270}, {100, 32}}", | |
"class" : "Button", | |
"nodes" : [ | |
], | |
"attributes" : { | |
"action" : "equation2_touch_up_inside", | |
"frame" : "{{472, 368}, {80, 32}}", | |
"title" : "4\/2+5=", | |
"uuid" : "7566589A-FCE1-4D29-A236-9F4281DBDDD5", | |
"class" : "Button", | |
"name" : "equation2_button", | |
"font_size" : 15 | |
} | |
}, | |
{ | |
"selected" : false, | |
"frame" : "{{303, 338}, {100, 32}}", | |
"class" : "Button", | |
"nodes" : [ | |
], | |
"attributes" : { | |
"action" : "equation3_touch_up_inside", | |
"frame" : "{{472, 368}, {80, 32}}", | |
"title" : "3+4*2=", | |
"uuid" : "FF8FF277-BEC1-4C86-B1E9-9E33D2F3A3D4", | |
"class" : "Button", | |
"name" : "equation3_button", | |
"font_size" : 15 | |
} | |
}, | |
{ | |
"selected" : true, | |
"frame" : "{{303, 400}, {100, 32}}", | |
"class" : "Button", | |
"nodes" : [ | |
], | |
"attributes" : { | |
"action" : "equation4_touch_up_inside", | |
"frame" : "{{472, 368}, {80, 32}}", | |
"title" : "7-3+2=", | |
"uuid" : "EA4C29D3-76D3-4235-851A-6B8DC01F519D", | |
"class" : "Button", | |
"name" : "equation4_button", | |
"font_size" : 15 | |
} | |
}, | |
{ | |
"selected" : false, | |
"frame" : "{{434, 192}, {150, 32}}", | |
"class" : "Label", | |
"nodes" : [ | |
], | |
"attributes" : { | |
"font_name" : "<System>", | |
"frame" : "{{437, 368}, {150, 32}}", | |
"uuid" : "20608843-483A-4D78-A1DD-963D30F1C2F0", | |
"class" : "Label", | |
"alignment" : "left", | |
"text" : "", | |
"name" : "answer1_label", | |
"font_size" : 18 | |
} | |
}, | |
{ | |
"selected" : false, | |
"frame" : "{{434, 270}, {150, 32}}", | |
"class" : "Label", | |
"nodes" : [ | |
], | |
"attributes" : { | |
"font_name" : "<System>", | |
"frame" : "{{437, 368}, {150, 32}}", | |
"uuid" : "230538D7-0658-4EA5-A22A-9EA2BD9165A1", | |
"class" : "Label", | |
"alignment" : "left", | |
"text" : "", | |
"name" : "answer2_label", | |
"font_size" : 18 | |
} | |
}, | |
{ | |
"selected" : false, | |
"frame" : "{{434, 338}, {150, 32}}", | |
"class" : "Label", | |
"nodes" : [ | |
], | |
"attributes" : { | |
"font_name" : "<System>", | |
"frame" : "{{437, 368}, {150, 32}}", | |
"uuid" : "C57F1DE5-95E0-4B8C-955B-B29FFDBF7A9F", | |
"class" : "Label", | |
"alignment" : "left", | |
"text" : "", | |
"name" : "answer3_label", | |
"font_size" : 18 | |
} | |
}, | |
{ | |
"selected" : false, | |
"frame" : "{{434, 400}, {150, 32}}", | |
"class" : "Label", | |
"nodes" : [ | |
], | |
"attributes" : { | |
"font_name" : "<System>", | |
"frame" : "{{437, 368}, {150, 32}}", | |
"uuid" : "14630BFA-6D97-47FA-B823-55AB7C86074F", | |
"class" : "Label", | |
"alignment" : "left", | |
"text" : "", | |
"name" : "answer4_label", | |
"font_size" : 18 | |
} | |
} | |
], | |
"attributes" : { | |
"enabled" : true, | |
"background_color" : "RGBA(1.000000,1.000000,1.000000,1.000000)", | |
"tint_color" : "RGBA(0.000000,0.478000,1.000000,1.000000)", | |
"border_color" : "RGBA(0.000000,0.000000,0.000000,1.000000)", | |
"flex" : "" | |
} | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment