Skip to content

Instantly share code, notes, and snippets.

@Mr-Coxall
Created September 3, 2016 02:29
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/bfaeda61bed7b8b7dd39c4dd289dc9c4 to your computer and use it in GitHub Desktop.
Save Mr-Coxall/bfaeda61bed7b8b7dd39c4dd289dc9c4 to your computer and use it in GitHub Desktop.
sprites
# Created by: Mr. Coxall
# Created on: Aug 2016
# Created for: ICS3U
# This program shows images
import ui
# first get a reference to the image you saved in your Python folder
my_pic = ui.Image.named('sprites/MT_crest.jpg')
# then create an ImageView to show it in
my_image = ui.ImageView(frame=(100, 100, 200, 300))
# then add the image into the ImageView
my_image.image = my_pic
view = ui.load_view()
# lastly, add the Imageview into the existing view
view.add_subview(my_image)
view.present('full_screen')
[
{
"selected" : false,
"frame" : "{{0, 0}, {1024, 768}}",
"class" : "View",
"nodes" : [
{
"selected" : true,
"frame" : "{{462, 334}, {100, 100}}",
"class" : "ImageView",
"nodes" : [
],
"attributes" : {
"flex" : "LRTB",
"frame" : "{{462, 334}, {100, 100}}",
"image_name" : "iob:social_github_outline_256",
"class" : "ImageView",
"name" : "github_sprite",
"uuid" : "84016779-A647-43CA-8F71-246CD6E2B6BD"
}
}
],
"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