Skip to content

Instantly share code, notes, and snippets.

@Mr-Coxall
Last active July 1, 2018 02:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mr-Coxall/e4379294c812bb061a79355371447c54 to your computer and use it in GitHub Desktop.
Save Mr-Coxall/e4379294c812bb061a79355371447c54 to your computer and use it in GitHub Desktop.
hello_world_international.pdf
# Created by: Mr. Coxall
# Created on: Aug 2018
# Created for: ICS3U
# This program is the Hello, World program, but with 3 buttons
import ui
def english_touch_up_inside(sender):
# displays the English version
view['hello_world_label'].text = ('Hello, World!')
def french_touch_up_inside(sender):
# displays the French version
view['hello_world_label'].text = ('Bonjour le monde!')
def spanish_touch_up_inside(sender):
# displays the Spanish version
view['hello_world_label'].text = ('¡Hola Mundo!')
# note that now the app runs full screen
view = ui.load_view()
view.present('full_screen')
[
{
"selected" : false,
"frame" : "{{0, 0}, {1024, 768}}",
"class" : "View",
"nodes" : [
{
"selected" : false,
"frame" : "{{363, 371}, {300, 35}}",
"class" : "Label",
"nodes" : [
],
"attributes" : {
"flex" : "WH",
"font_name" : "<System>",
"frame" : "{{437, 368}, {150, 32}}",
"uuid" : "67E4E4DF-B0E3-491F-AA9F-1598E0804C07",
"class" : "Label",
"alignment" : "center",
"text" : "Hello, World!",
"name" : "hello_world_label",
"font_size" : 18
}
},
{
"selected" : false,
"frame" : "{{363, 435}, {80, 32}}",
"class" : "Button",
"nodes" : [
],
"attributes" : {
"action" : "english_touch_up_inside",
"flex" : "WHRTB",
"frame" : "{{472, 368}, {80, 32}}",
"title" : "English",
"uuid" : "DDA4F504-D20E-401F-839D-0232D7EB90AF",
"class" : "Button",
"name" : "english_button",
"font_size" : 15
}
},
{
"selected" : true,
"frame" : "{{583, 435}, {80, 32}}",
"class" : "Button",
"nodes" : [
],
"attributes" : {
"action" : "spanish_touch_up_inside",
"flex" : "WHLTB",
"frame" : "{{472, 368}, {80, 32}}",
"title" : "Spanish",
"uuid" : "9F52F9BF-1AA1-404E-BA48-A6736C5D7707",
"class" : "Button",
"name" : "Spanish",
"font_size" : 15
}
},
{
"selected" : false,
"frame" : "{{478, 435}, {80, 32}}",
"class" : "Button",
"nodes" : [
],
"attributes" : {
"action" : "french_touch_up_inside",
"flex" : "WHLRTB",
"frame" : "{{472, 368}, {80, 32}}",
"title" : "French",
"uuid" : "15B7FF5B-127A-46D6-8671-2D4EBC4AA17E",
"class" : "Button",
"name" : "french_button",
"font_size" : 15
}
}
],
"attributes" : {
"name" : "",
"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