Skip to content

Instantly share code, notes, and snippets.

@Softwave
Created March 12, 2016 03:38
Show Gist options
  • Save Softwave/0b84e34bbe6d4b243646 to your computer and use it in GitHub Desktop.
Save Softwave/0b84e34bbe6d4b243646 to your computer and use it in GitHub Desktop.
Reverse.py
# coding: utf-8
import ui
def btn_reverse(sender):
in_string = str(tfield.text)
rlabel.text = in_string[::-1]
v = ui.load_view()
v.present('sheet')
tfield = v['textfield1']
rlabel = v['label1']
[
{
"selected" : false,
"frame" : "{{0, 0}, {320, 480}}",
"class" : "View",
"nodes" : [
{
"selected" : false,
"frame" : "{{0, 0}, {320, 480}}",
"class" : "View",
"nodes" : [
],
"attributes" : {
"uuid" : "5E740A3B-AC57-4181-B248-232C0E08CF8E",
"frame" : "{{110, 190}, {100, 100}}",
"background_color" : "RGBA(1.000000,0.444444,0.444444,1.000000)",
"class" : "View",
"name" : "view1",
"flex" : "WH"
}
},
{
"selected" : false,
"frame" : "{{69, 6}, {200, 32}}",
"class" : "TextField",
"nodes" : [
],
"attributes" : {
"uuid" : "AA78C054-C1C9-4FC8-9B6C-2E2D771E81FA",
"flex" : "W",
"corner_radius" : 7,
"frame" : "{{60, 224}, {200, 32}}",
"border_color" : "RGBA(1.000000,0.666667,0.666667,1.000000)",
"border_width" : 3,
"alignment" : "left",
"autocorrection_type" : "default",
"font_name" : "<System>",
"spellchecking_type" : "default",
"class" : "TextField",
"name" : "textfield1",
"font_size" : 17
}
},
{
"selected" : false,
"frame" : "{{126, 46}, {80, 32}}",
"class" : "Button",
"nodes" : [
],
"attributes" : {
"uuid" : "97EDC569-DC5F-4148-9EAA-231AAF316733",
"flex" : "W",
"corner_radius" : 7,
"background_color" : "RGBA(1.000000,0.888889,0.888889,1.000000)",
"frame" : "{{120, 224}, {80, 32}}",
"tint_color" : "RGBA(1.000000,0.555556,0.555556,1.000000)",
"border_width" : 3,
"border_color" : "RGBA(1.000000,0.666667,0.666667,1.000000)",
"title" : "Reverse",
"action" : "btn_reverse",
"class" : "Button",
"name" : "button1",
"font_size" : 15
}
},
{
"selected" : true,
"frame" : "{{69, 86}, {200, 32}}",
"class" : "Label",
"nodes" : [
],
"attributes" : {
"uuid" : "1E82E77B-D52F-4BB4-A761-8F6003F4E8AE",
"font_size" : 18,
"corner_radius" : 0,
"frame" : "{{85, 224}, {150, 32}}",
"tint_color" : "RGBA(1.000000,0.666667,0.666667,1.000000)",
"border_width" : 0,
"border_color" : "RGBA(1.000000,0.666667,0.666667,1.000000)",
"alignment" : "center",
"text" : "",
"text_color" : "RGBA(1.000000,0.888889,0.888889,1.000000)",
"font_name" : "<System>",
"class" : "Label",
"name" : "label1",
"flex" : "W"
}
}
],
"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