Skip to content

Instantly share code, notes, and snippets.

Created September 30, 2017 16:16
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 anonymous/be83833f8c5c34e50f3426fc96ff04aa to your computer and use it in GitHub Desktop.
Save anonymous/be83833f8c5c34e50f3426fc96ff04aa to your computer and use it in GitHub Desktop.
gui_test.py
import ui
import random
def increment_action(sender):
l = sender.superview['textfield1']
l.text = str(int(l.text)+1)
def random_action(sender):
sender.superview['textfield1'].text = str(random.randint(0,100))
v = ui.load_view()
v.present('sheet')
[
{
"class" : "View",
"attributes" : {
"background_color" : "RGBA(1.000000,1.000000,1.000000,1.000000)",
"tint_color" : "RGBA(0.000000,0.478000,1.000000,1.000000)",
"enabled" : true,
"border_color" : "RGBA(0.000000,0.000000,0.000000,1.000000)",
"flex" : ""
},
"frame" : "{{0, 0}, {435, 282}}",
"selected" : false,
"nodes" : [
{
"class" : "TextField",
"attributes" : {
"font_size" : 17,
"font_name" : "<System>",
"text" : "0",
"autocorrection_type" : "default",
"name" : "textfield1",
"uuid" : "CE2D358B-08B7-44BE-B18F-707E1018D03D",
"class" : "TextField",
"alignment" : "right",
"placeholder" : "",
"frame" : "{{104, 181}, {200, 32}}",
"spellchecking_type" : "default"
},
"frame" : "{{72, 46}, {337, 64}}",
"selected" : true,
"nodes" : [
]
},
{
"class" : "Button",
"attributes" : {
"font_size" : 15,
"title" : "increment",
"name" : "button1",
"action" : "increment_action",
"class" : "Button",
"frame" : "{{164, 181}, {80, 32}}",
"uuid" : "BD6C1448-9B3F-40BF-84B1-8DC608503079"
},
"frame" : "{{82, 181}, {127, 74}}",
"selected" : false,
"nodes" : [
]
},
{
"class" : "Button",
"attributes" : {
"font_size" : 15,
"title" : "random",
"name" : "button2",
"action" : "random_action",
"class" : "Button",
"frame" : "{{178, 125}, {80, 32}}",
"uuid" : "0ECD4249-AAFD-42E3-823D-7EADFF135D69"
},
"frame" : "{{271, 181}, {138, 66}}",
"selected" : false,
"nodes" : [
]
}
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment