Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Change a label to user entry info from text field with button
-
@shp Sorry, I don't understand the question
You could do that at start of your program
import ui def tf_action(sender): v["label1"].text = v["textfield1"].text unused = ui.load_view() v = unused['scrollview1'] v.background_color = 'lightgray' for sv in unused.subviews: unused.remove_subview(sv) if sv != v: v.add_subview(sv) del unused v.present('sheet')
-
Still not working
Here is pyui file as txt file
// either side of script//
//[
{
"nodes" : [
{
"nodes" : [], "frame" : "{{0, 0}, {1000, 1400}}", "class" : "ScrollView", "attributes" : { "border_width" : 0, "frame" : "{{340, 1090}, {320, 320}}", "uuid" : "8D302B37-3DE8-45FC-A527-F0F9F30965CD", "content_height" : 1600, "class" : "ScrollView", "content_width" : 1200, "corner_radius" : 0, "name" : "scrollview1" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{872, 49}, {51, 31}}", "class" : "Switch", "attributes" : { "action" : "func3", "alpha" : 1, "frame" : "{{475, 385}, {51, 31}}", "class" : "Switch", "uuid" : "D30F9226-1BEE-4927-AF46-EA465C7FC916", "value" : false, "name" : "switch1" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{542, 48}, {51, 31}}", "class" : "Switch", "attributes" : { "action" : "func2", "frame" : "{{475, 385}, {51, 31}}", "value" : false, "class" : "Switch", "name" : "switch2", "uuid" : "1EC9CC30-1479-438F-ADD1-C88F47027677" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{267, 47}, {51, 31}}", "class" : "Switch", "attributes" : { "action" : "func", "frame" : "{{475, 385}, {51, 31}}", "value" : false, "class" : "Switch", "name" : "switch3", "uuid" : "885A8519-4F64-4C2A-876B-D223AE49315E" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{619, 48}, {238, 32}}", "class" : "Label", "attributes" : { "font_size" : 10, "frame" : "{{425, 384}, {150, 32}}", "uuid" : "0C1268DB-C0AE-4F4C-94FB-1C93D4148AD2", "class" : "Label", "alignment" : "left", "text" : "Pain attacks with or without pain between them", "background_color" : "RGBA(0.560784,1.000000,0.709804,1.000000)", "name" : "label2", "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{336, 47}, {183, 32}}", "class" : "Label", "attributes" : { "font_size" : 10, "frame" : "{{425, 384}, {150, 32}}", "uuid" : "CFDF54CF-A204-4310-AA1F-81B0AFDB2879", "class" : "Label", "alignment" : "left", "text" : "Persistent pain with pain attacks", "background_color" : "RGBA(0.560784,1.000000,0.709804,1.000000)", "name" : "label3", "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{62, 46}, {197, 32}}", "class" : "Label", "attributes" : { "font_size" : 10, "frame" : "{{425, 384}, {150, 32}}", "uuid" : "9CE218D9-B2F9-4135-847A-10422071A886", "class" : "Label", "alignment" : "left", "text" : "Persistent pain with slight fluctuations", "background_color" : "RGBA(0.560784,1.000000,0.709804,1.000000)", "name" : "label4", "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{417, 104}, {51, 31}}", "class" : "Switch", "attributes" : { "uuid" : "1EC9CC30-1479-438F-ADD1-C88F47027677", "frame" : "{{475, 385}, {51, 31}}", "value" : false, "class" : "Switch", "name" : "switch4", "action" : "func4" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{424, 1034}, {169, 42}}", "class" : "Label", "attributes" : { "uuid" : "BD8CA992-3E30-4B89-A809-540A43D13D6A", "corner_radius" : 20, "background_color" : "RGBA(0.584314,1.000000,0.584314,1.000000)", "frame" : "{{425, 384}, {150, 32}}", "tint_color" : "RGBA(0.541176,1.000000,0.541176,1.000000)", "border_width" : 5, "custom_attributes" : "", "alignment" : "center", "text" : "score", "font_name" : "<System>", "class" : "Label", "name" : "label8", "font_size" : 18 }, "selected" : false }, { "nodes" : [ ], "frame" : "{{77, 226}, {747, 34}}", "class" : "Slider", "attributes" : { "continuous" : false, "uuid" : "F276E893-E1B8-48D1-A2B8-54628490A404", "corner_radius" : 10, "background_color" : "RGBA(1.000000,1.000000,0.623529,1.000000)", "frame" : "{{400, 383}, {200, 34}}", "border_width" : 0, "value" : 0, "action" : "slider1", "alpha" : 1, "class" : "Slider", "name" : "slider1", "flex" : "W" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{53, 188}, {696, 39}}", "class" : "TextField", "attributes" : { "uuid" : "C3E651BC-79B1-45C4-8691-31B10D48550F", "corner_radius" : 10, "background_color" : "RGBA(1.000000,1.000000,0.709804,1.000000)", "frame" : "{{400, 384}, {200, 32}}", "border_width" : 0, "alignment" : "left", "autocorrection_type" : "default", "text" : "never. hardly-noticed. slightly. moderately. strongly. very-strongly", "font_name" : "<System>", "spellchecking_type" : "default", "class" : "TextField", "name" : "textfield2", "font_size" : 17 }, "selected" : false }, { "nodes" : [ ], "frame" : "{{53, 6}, {579, 32}}", "class" : "TextField", "attributes" : { "uuid" : "98A71D98-7E4B-46A2-8917-9889CA606953", "corner_radius" : 10, "background_color" : "RGBA(1.000000,1.000000,0.584314,1.000000)", "frame" : "{{400, 384}, {200, 32}}", "border_color" : "RGBA(1.000000,0.478431,0.478431,1.000000)", "border_width" : 2, "alignment" : "left", "autocorrection_type" : "default", "text" : "Mark the situation that best describes the course of your pain (pick one)", "text_color" : "RGBA(1.000000,0.270588,0.270588,1.000000)", "font_name" : "<System>", "spellchecking_type" : "default", "class" : "TextField", "name" : "textfield1", "font_size" : 17 }, "selected" : false }, { "nodes" : [ ], "frame" : "{{316, 104}, {58, 32}}", "class" : "TextField", "attributes" : { "font_size" : 17, "frame" : "{{400, 484}, {200, 32}}", "spellchecking_type" : "default", "class" : "TextField", "uuid" : "5633F4C5-8C1A-4BEB-8C73-6F03DAA6CBEB", "alignment" : "left", "text" : "Yes", "autocorrection_type" : "default", "name" : "textfield3", "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{53, 305.5}, {696, 39}}", "class" : "TextField", "attributes" : { "uuid" : "C3E651BC-79B1-45C4-8691-31B10D48550F", "corner_radius" : 10, "background_color" : "RGBA(1.000000,1.000000,0.709804,1.000000)", "frame" : "{{400, 384}, {200, 32}}", "border_width" : 0, "alignment" : "left", "autocorrection_type" : "default", "text" : "never. hardly-noticed. slightly. moderately. strongly. very-strongly", "font_name" : "<System>", "spellchecking_type" : "default", "class" : "TextField", "name" : "textfield2", "font_size" : 17 }, "selected" : false }, { "nodes" : [ ], "frame" : "{{53, 433}, {696, 39}}", "class" : "TextField", "attributes" : { "uuid" : "C3E651BC-79B1-45C4-8691-31B10D48550F", "corner_radius" : 10, "background_color" : "RGBA(1.000000,1.000000,0.709804,1.000000)", "frame" : "{{400, 384}, {200, 32}}", "border_width" : 0, "alignment" : "left", "autocorrection_type" : "default", "text" : "never. hardly-noticed. slightly. moderately. strongly. very-strongly", "font_name" : "<System>", "spellchecking_type" : "default", "class" : "TextField", "name" : "textfield2", "font_size" : 17 }, "selected" : false }, { "nodes" : [ ], "frame" : "{{53, 547.5}, {696, 39}}", "class" : "TextField", "attributes" : { "uuid" : "C3E651BC-79B1-45C4-8691-31B10D48550F", "corner_radius" : 10, "background_color" : "RGBA(1.000000,1.000000,0.709804,1.000000)", "frame" : "{{400, 384}, {200, 32}}", "border_width" : 0, "alignment" : "left", "autocorrection_type" : "default", "text" : "never. hardly-noticed. slightly. moderately. strongly. very-strongly", "font_name" : "<System>", "spellchecking_type" : "default", "class" : "TextField", "name" : "textfield2", "font_size" : 17 }, "selected" : false }, { "nodes" : [ ], "frame" : "{{53, 666.5}, {696, 39}}", "class" : "TextField", "attributes" : { "uuid" : "C3E651BC-79B1-45C4-8691-31B10D48550F", "corner_radius" : 10, "background_color" : "RGBA(1.000000,1.000000,0.709804,1.000000)", "frame" : "{{400, 384}, {200, 32}}", "border_width" : 0, "alignment" : "left", "autocorrection_type" : "default", "text" : "never. hardly-noticed. slightly. moderately. strongly. very-strongly", "font_name" : "<System>", "spellchecking_type" : "default", "class" : "TextField", "name" : "textfield2", "font_size" : 17 }, "selected" : false }, { "nodes" : [ ], "frame" : "{{53, 783.5}, {696, 39}}", "class" : "TextField", "attributes" : { "uuid" : "C3E651BC-79B1-45C4-8691-31B10D48550F", "corner_radius" : 10, "background_color" : "RGBA(1.000000,1.000000,0.709804,1.000000)", "frame" : "{{400, 384}, {200, 32}}", "border_width" : 0, "alignment" : "left", "autocorrection_type" : "default", "text" : "never. hardly-noticed. slightly. moderately. strongly. very-strongly", "font_name" : "<System>", "spellchecking_type" : "default", "class" : "TextField", "name" : "textfield2", "font_size" : 17 }, "selected" : false }, { "nodes" : [ ], "frame" : "{{77, 343}, {747, 34}}", "class" : "Slider", "attributes" : { "continuous" : false, "uuid" : "F276E893-E1B8-48D1-A2B8-54628490A404", "corner_radius" : 10, "background_color" : "RGBA(1.000000,1.000000,0.623529,1.000000)", "frame" : "{{400, 383}, {200, 34}}", "border_width" : 0, "value" : 0, "action" : "slider2", "alpha" : 1, "class" : "Slider", "name" : "slider2", "flex" : "W" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{77, 470}, {747, 34}}", "class" : "Slider", "attributes" : { "continuous" : false, "uuid" : "F276E893-E1B8-48D1-A2B8-54628490A404", "corner_radius" : 10, "background_color" : "RGBA(1.000000,1.000000,0.623529,1.000000)", "frame" : "{{400, 383}, {200, 34}}", "border_width" : 0, "value" : 0, "action" : "slider3", "alpha" : 1, "class" : "Slider", "name" : "slider3", "flex" : "W" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{77, 585}, {747, 34}}", "class" : "Slider", "attributes" : { "continuous" : false, "uuid" : "F276E893-E1B8-48D1-A2B8-54628490A404", "corner_radius" : 10, "background_color" : "RGBA(1.000000,1.000000,0.623529,1.000000)", "frame" : "{{400, 383}, {200, 34}}", "border_width" : 0, "value" : 0, "action" : "slider4", "alpha" : 1, "class" : "Slider", "name" : "slider4", "flex" : "W" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{77, 701}, {747, 34}}", "class" : "Slider", "attributes" : { "text_color" : "RGBA(1.000000,0.270588,0.270588,1.000000)", "class" : "Slider", "frame" : "{{400, 383}, {200, 34}}", "border_width" : 2, "font_name" : "<System>", "corner_radius" : 10, "action" : "slider5", "uuid" : "F276E893-E1B8-48D1-A2B8-54628490A404", "background_color" : "RGBA(1.000000,1.000000,0.584314,1.000000)", "autocorrection_type" : "default", "name" : "slider5", "continuous" : false, "alpha" : 1, "spellchecking_type" : "default", "flex" : "W", "value" : 0, "text" : "Do you suffer from a burning sensation (e.g., stinging nettles) in the painful areas?\")", "font_size" : 17, "alignment" : "left", "border_color" : "RGBA(1.000000,1.000000,1.000000,1.000000)" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{77, 944}, {747, 34}}", "class" : "Slider", "attributes" : { "continuous" : false, "uuid" : "F276E893-E1B8-48D1-A2B8-54628490A404", "corner_radius" : 10, "background_color" : "RGBA(1.000000,1.000000,0.623529,1.000000)", "frame" : "{{400, 383}, {200, 34}}", "border_width" : 0, "value" : 0, "action" : "slider7", "alpha" : 1, "class" : "Slider", "name" : "slider7", "flex" : "W" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{53, 276.5}, {696, 32}}", "class" : "TextField", "attributes" : { "uuid" : "98A71D98-7E4B-46A2-8917-9889CA606953", "corner_radius" : 10, "background_color" : "RGBA(1.000000,1.000000,0.584314,1.000000)", "frame" : "{{400, 384}, {200, 32}}", "border_color" : "RGBA(1.000000,0.478431,0.478431,1.000000)", "border_width" : 2, "alignment" : "left", "autocorrection_type" : "default", "text" : "Do you have a tingling or prickling sensation in the area of your pain (like crawling ants or electrical tingling)?", "text_color" : "RGBA(1.000000,0.270588,0.270588,1.000000)", "font_name" : "<System>", "spellchecking_type" : "default", "class" : "TextField", "name" : "textfield1", "font_size" : 13 }, "selected" : false }, { "nodes" : [ ], "frame" : "{{53, 401}, {696, 32}}", "class" : "TextField", "attributes" : { "uuid" : "98A71D98-7E4B-46A2-8917-9889CA606953", "corner_radius" : 10, "background_color" : "RGBA(1.000000,1.000000,0.584314,1.000000)", "frame" : "{{400, 384}, {200, 32}}", "border_color" : "RGBA(1.000000,0.478431,0.478431,1.000000)", "border_width" : 2, "alignment" : "left", "autocorrection_type" : "default", "text" : " Is light touching (clothing, a blanket) in this area painful?", "text_color" : "RGBA(1.000000,0.270588,0.270588,1.000000)", "font_name" : "<System>", "spellchecking_type" : "default", "class" : "TextField", "name" : "textfield1", "font_size" : 17 }, "selected" : false }, { "nodes" : [ ], "frame" : "{{53, 520}, {696, 32}}", "class" : "TextField", "attributes" : { "uuid" : "98A71D98-7E4B-46A2-8917-9889CA606953", "corner_radius" : 10, "background_color" : "RGBA(1.000000,1.000000,0.584314,1.000000)", "frame" : "{{400, 384}, {200, 32}}", "border_color" : "RGBA(1.000000,0.478431,0.478431,1.000000)", "border_width" : 2, "alignment" : "left", "autocorrection_type" : "default", "text" : " Do you have sudden pain attacks in the area of your pain, like electric shocks?", "text_color" : "RGBA(1.000000,0.270588,0.270588,1.000000)", "font_name" : "<System>", "spellchecking_type" : "default", "class" : "TextField", "name" : "textfield1", "font_size" : 17 }, "selected" : false }, { "nodes" : [ ], "frame" : "{{53, 637}, {696, 32}}", "class" : "TextField", "attributes" : { "uuid" : "98A71D98-7E4B-46A2-8917-9889CA606953", "corner_radius" : 10, "background_color" : "RGBA(1.000000,1.000000,0.584314,1.000000)", "frame" : "{{400, 384}, {200, 32}}", "border_color" : "RGBA(1.000000,0.478431,0.478431,1.000000)", "border_width" : 2, "alignment" : "left", "autocorrection_type" : "default", "text" : " Is cold or heat (bath water) in this area occasionally painful?", "text_color" : "RGBA(1.000000,0.270588,0.270588,1.000000)", "font_name" : "<System>", "spellchecking_type" : "default", "class" : "TextField", "name" : "textfield1", "font_size" : 17 }, "selected" : false }, { "nodes" : [ ], "frame" : "{{53, 756}, {696, 32}}", "class" : "TextField", "attributes" : { "uuid" : "98A71D98-7E4B-46A2-8917-9889CA606953", "corner_radius" : 10, "background_color" : "RGBA(1.000000,1.000000,0.584314,1.000000)", "frame" : "{{400, 384}, {200, 32}}", "border_color" : "RGBA(1.000000,0.478431,0.478431,1.000000)", "border_width" : 2, "alignment" : "left", "autocorrection_type" : "default", "text" : "Do you suffer from a sensation of numbness in the areas that you marked?", "text_color" : "RGBA(1.000000,0.270588,0.270588,1.000000)", "font_name" : "<System>", "spellchecking_type" : "default", "class" : "TextField", "name" : "textfield1", "font_size" : 17 }, "selected" : false }, { "nodes" : [ ], "frame" : "{{53, 104}, {200, 32}}", "class" : "TextField", "attributes" : { "uuid" : "98A71D98-7E4B-46A2-8917-9889CA606953", "corner_radius" : 10, "background_color" : "RGBA(1.000000,1.000000,0.584314,1.000000)", "frame" : "{{400, 384}, {200, 32}}", "border_color" : "RGBA(1.000000,0.478431,0.478431,1.000000)", "border_width" : 2, "alignment" : "left", "autocorrection_type" : "default", "text" : "Does your pain radiate? ", "text_color" : "RGBA(1.000000,0.270588,0.270588,1.000000)", "font_name" : "<System>", "spellchecking_type" : "default", "class" : "TextField", "name" : "textfield1", "font_size" : 17 }, "selected" : false }, { "nodes" : [ ], "frame" : "{{53, 872}, {696, 32}}", "class" : "TextField", "attributes" : { "uuid" : "98A71D98-7E4B-46A2-8917-9889CA606953", "corner_radius" : 10, "background_color" : "RGBA(1.000000,1.000000,0.584314,1.000000)", "frame" : "{{400, 384}, {200, 32}}", "border_color" : "RGBA(1.000000,0.478431,0.478431,1.000000)", "border_width" : 2, "alignment" : "left", "autocorrection_type" : "default", "text" : "Does slight pressure in this area, e.g., with a finger, trigger pain?\")", "text_color" : "RGBA(1.000000,0.270588,0.270588,1.000000)", "font_name" : "<System>", "spellchecking_type" : "default", "class" : "TextField", "name" : "textfield1", "font_size" : 17 }, "selected" : false }, { "nodes" : [ ], "frame" : "{{53, 904}, {696, 39}}", "class" : "TextField", "attributes" : { "uuid" : "C3E651BC-79B1-45C4-8691-31B10D48550F", "corner_radius" : 10, "background_color" : "RGBA(1.000000,1.000000,0.709804,1.000000)", "frame" : "{{400, 384}, {200, 32}}", "border_width" : 0, "alignment" : "left", "autocorrection_type" : "default", "text" : "never. hardly-noticed. slightly. moderately. strongly. very-strongly", "font_name" : "<System>", "spellchecking_type" : "default", "class" : "TextField", "name" : "textfield2", "font_size" : 17 }, "selected" : false }, { "nodes" : [ ], "frame" : "{{53, 157}, {696, 32}}", "class" : "TextField", "attributes" : { "uuid" : "98A71D98-7E4B-46A2-8917-9889CA606953", "corner_radius" : 10, "background_color" : "RGBA(1.000000,1.000000,0.584314,1.000000)", "frame" : "{{400, 384}, {200, 32}}", "border_color" : "RGBA(1.000000,0.478431,0.478431,1.000000)", "border_width" : 2, "alignment" : "left", "autocorrection_type" : "default", "text" : "Do you suffer from a burning sensation (e.g., stinging nettles) in the painful areas?", "text_color" : "RGBA(1.000000,0.270588,0.270588,1.000000)", "font_name" : "<System>", "spellchecking_type" : "default", "class" : "TextField", "name" : "textfield1", "font_size" : 17 }, "selected" : false }, { "nodes" : [ ], "frame" : "{{77, 822}, {747, 34}}", "class" : "Slider", "attributes" : { "text_color" : "RGBA(1.000000,0.270588,0.270588,1.000000)", "class" : "Slider", "frame" : "{{400, 383}, {200, 34}}", "border_width" : 2, "font_name" : "<System>", "corner_radius" : 10, "action" : "slider6", "uuid" : "F276E893-E1B8-48D1-A2B8-54628490A404", "background_color" : "RGBA(1.000000,1.000000,0.584314,1.000000)", "autocorrection_type" : "default", "name" : "slider6", "continuous" : false, "alpha" : 1, "spellchecking_type" : "default", "flex" : "W", "value" : 0, "text" : "Do you suffer from a burning sensation (e.g., stinging nettles) in the painful areas?\")", "font_size" : 17, "alignment" : "left", "border_color" : "RGBA(1.000000,1.000000,1.000000,1.000000)" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{194, 1031}, {170, 45}}", "class" : "Button", "attributes" : { "action" : "paindetect", "border_width" : 5, "frame" : "{{460, 1234}, {80, 32}}", "title" : "calculate pd score", "uuid" : "D83FBEB9-BBA3-40F6-8783-4E08EE8619BC", "background_color" : "RGBA(1.000000,1.000000,1.000000,1.000000)", "class" : "Button", "corner_radius" : 20, "name" : "button1", "font_size" : 15 }, "selected" : false }, { "nodes" : [ ], "frame" : "{{194, 1172}, {441, 39}}", "class" : "TextField", "attributes" : { "uuid" : "7733A773-F4DA-4235-ACF6-98ED26F47B4E", "frame" : "{{450, 684}, {200, 32}}", "custom_attributes" : "{'action':button_action\n}", "action" : "", "alignment" : "left", "autocorrection_type" : "default", "placeholder" : "please enter you name and dob", "font_name" : "<System>", "spellchecking_type" : "default", "class" : "TextField", "name" : "textfield4", "font_size" : 17 }, "selected" : true }, { "nodes" : [ ], "frame" : "{{194, 1108}, {286, 32}}", "class" : "TextField", "attributes" : { "placeholder" : "please enter todays date", "name" : "textfield5", "frame" : "{{450, 684}, {200, 32}}", "spellchecking_type" : "default", "class" : "TextField", "uuid" : "5C5672E9-14D3-45E8-B308-8BA8D8C23482", "alignment" : "left", "custom_attributes" : "{'action':button_action2}", "autocorrection_type" : "default", "font_size" : 17, "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{237, 1313}, {186, 68}}", "class" : "Button", "attributes" : { "border_width" : 5, "action" : "button_close", "frame" : "{{510, 684}, {80, 32}}", "title" : "FINISHED (thankyou!)", "uuid" : "D60EACF8-512D-4310-9AF2-DF48D7A82455", "class" : "Button", "corner_radius" : 20, "background_color" : "RGBA(1.000000,1.000000,0.749020,1.000000)", "name" : "button2", "font_size" : 15 }, "selected" : false }, { "nodes" : [ ], "frame" : "{{194, 1237}, {359, 32}}", "class" : "TextField", "attributes" : { "name" : "textfield6", "frame" : "{{450, 684}, {200, 32}}", "spellchecking_type" : "default", "class" : "TextField", "uuid" : "514DB074-8B00-4690-BA7F-64F44694CB50", "alignment" : "left", "text" : "ok to save your results? type Y or N —>", "autocorrection_type" : "default", "font_size" : 17, "font_name" : "<System>" }, "selected" : false } ], "frame" : "{{0, 0}, {1100, 1400}}", "class" : "View", "attributes" : { "flex" : "", "custom_class" : "", "enabled" : true, "tint_color" : "RGBA(0.000000,0.478000,1.000000,1.000000)", "border_color" : "RGBA(0.000000,0.000000,0.000000,1.000000)", "background_color" : "RGBA(0.560784,1.000000,0.709804,1.000000)", "name" : "THE PAIN DETECT APP" }, "selected" : false
}
]// -
@shp sorry . This one
//[
{
"nodes" : [
{
"nodes" : [
{
"nodes" : [], "frame" : "{{55, 68}, {412, 28}}", "class" : "TextField", "attributes" : { "uuid" : "D06F745C-3074-435E-AFF5-EAAF34E86B5E", "frame" : "{{400, 684}, {200, 32}}", "custom_attributes" : "{'action':tf_action\n}", "action" : "tf_action", "alignment" : "left", "autocorrection_type" : "default", "placeholder" : "NAME", "font_name" : "<System>", "spellchecking_type" : "default", "class" : "TextField", "name" : "textfield1", "font_size" : 17 }, "selected" : false }, { "nodes" : [ ], "frame" : "{{55, 124}, {200, 32}}", "class" : "TextField", "attributes" : { "placeholder" : "DOB", "name" : "textfield2", "frame" : "{{650, 1234}, {200, 32}}", "spellchecking_type" : "default", "class" : "TextField", "uuid" : "11781714-1D7E-47DB-8596-456EAD50EA1D", "alignment" : "left", "autocorrection_type" : "default", "font_size" : 17, "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{320, 124}, {200, 32}}", "class" : "TextField", "attributes" : { "placeholder" : "SEX", "font_size" : 17, "frame" : "{{650, 984}, {200, 32}}", "spellchecking_type" : "default", "class" : "TextField", "uuid" : "B20C47C5-686D-4A1F-B29C-A9803CA568AA", "alignment" : "left", "autocorrection_type" : "default", "name" : "textfield3", "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{320, 173}, {344, 68}}", "class" : "DatePicker", "attributes" : { "border_width" : 0, "mode" : 1, "frame" : "{{590, 892}, {320, 216}}", "class" : "DatePicker", "background_color" : "RGBA(1.000000,1.000000,0.979167,1.000000)", "uuid" : "D00D303E-984E-4585-821F-E0B40A417BBA", "corner_radius" : 20, "name" : "datepicker1" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{55, 181}, {200, 32}}", "class" : "TextField", "attributes" : { "name" : "textfield4", "frame" : "{{650, 984}, {200, 32}}", "spellchecking_type" : "default", "class" : "TextField", "uuid" : "A285F787-F907-4AA0-B5EB-80ADFB183C4E", "alignment" : "left", "text" : "Todays Date", "autocorrection_type" : "default", "font_size" : 17, "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 699}, {548, 32}}", "class" : "TextField", "attributes" : { "font_size" : 17, "frame" : "{{650, 984}, {200, 32}}", "spellchecking_type" : "default", "class" : "TextField", "uuid" : "FC254712-12FA-411D-8BA9-1F239C064699", "alignment" : "left", "text" : "1: I worry all the time about whether the pain will end.", "autocorrection_type" : "default", "name" : "textfield5", "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 870}, {548, 32}}", "class" : "TextField", "attributes" : { "font_size" : 17, "frame" : "{{650, 984}, {200, 32}}", "spellchecking_type" : "default", "class" : "TextField", "uuid" : "323476A8-A343-4335-9238-3E5F0C26987E", "alignment" : "left", "text" : "3: It’s terrible and I think it’s never going to get any better", "autocorrection_type" : "default", "name" : "textfield6", "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 782}, {548, 32}}", "class" : "TextField", "attributes" : { "font_size" : 17, "frame" : "{{650, 984}, {200, 32}}", "spellchecking_type" : "default", "class" : "TextField", "uuid" : "29FCE403-3ECD-4FE9-8894-D18EBA4C752B", "alignment" : "left", "text" : "2: I feel I can’t go on. ", "autocorrection_type" : "default", "name" : "textfield7", "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 962}, {548, 33}}", "class" : "TextField", "attributes" : { "font_size" : 17, "frame" : "{{650, 984}, {200, 32}}", "spellchecking_type" : "default", "class" : "TextField", "uuid" : "DD22EB31-EF43-4EE3-A6C2-7E7185E0E37B", "alignment" : "left", "text" : "4: It’s awful and I feel that it overwhelms me.", "autocorrection_type" : "default", "name" : "textfield8", "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 1048}, {548, 32}}", "class" : "TextField", "attributes" : { "font_size" : 17, "frame" : "{{650, 984}, {200, 32}}", "spellchecking_type" : "default", "class" : "TextField", "uuid" : "DE79FC4F-DAB7-498E-BBCB-FD4F4F27E7B0", "alignment" : "left", "text" : "5: I feel I can’t stand it anymore", "autocorrection_type" : "default", "name" : "textfield9", "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 1766}, {548, 32}}", "class" : "TextField", "attributes" : { "font_size" : 17, "frame" : "{{650, 984}, {200, 32}}", "spellchecking_type" : "default", "class" : "TextField", "uuid" : "6F5D7AF7-0FD5-4171-970D-0EEDE1705088", "alignment" : "left", "text" : "13: I wonder whether something serious may happen.", "autocorrection_type" : "default", "name" : "textfield10", "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 1675}, {548, 32}}", "class" : "TextField", "attributes" : { "font_size" : 17, "frame" : "{{650, 984}, {200, 32}}", "spellchecking_type" : "default", "class" : "TextField", "uuid" : "9F016E0A-9271-4431-830A-694DB9A9C33F", "alignment" : "left", "text" : "12: There’s nothing I can do to reduce the intensity of the pain", "autocorrection_type" : "default", "name" : "textfield11", "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 1584}, {548, 32}}", "class" : "TextField", "attributes" : { "font_size" : 17, "frame" : "{{650, 984}, {200, 32}}", "spellchecking_type" : "default", "class" : "TextField", "uuid" : "7E626293-D811-4EE2-8E72-8D91DD3E3E9D", "alignment" : "left", "text" : "11: I keep thinking about how badly I want the pain to stop", "autocorrection_type" : "default", "name" : "textfield12", "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 1510}, {548, 32}}", "class" : "TextField", "attributes" : { "font_size" : 17, "frame" : "{{650, 984}, {200, 32}}", "spellchecking_type" : "default", "class" : "TextField", "uuid" : "17B589EF-0987-4248-8919-9E0628201A98", "alignment" : "left", "text" : "10: I keep thinking about how much it hurts.", "autocorrection_type" : "default", "name" : "textfield13", "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 1356}, {1, 8}}", "class" : "TextField", "attributes" : { "font_size" : 17, "frame" : "{{650, 984}, {200, 32}}", "spellchecking_type" : "default", "class" : "TextField", "uuid" : "DB7DF76E-4757-426C-8F77-1DFCB675642A", "alignment" : "left", "text" : "9: I can’t seem to keep it our of my mind", "autocorrection_type" : "default", "name" : "textfield14", "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 1332}, {1, 8}}", "class" : "TextField", "attributes" : { "font_size" : 17, "frame" : "{{650, 984}, {200, 32}}", "spellchecking_type" : "default", "class" : "TextField", "uuid" : "6174722C-FC79-4980-A095-8D536D4EE005", "alignment" : "left", "text" : "8: I anxiously want the pain to go away", "autocorrection_type" : "default", "name" : "textfield15", "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 1238}, {548, 32}}", "class" : "TextField", "attributes" : { "font_size" : 17, "frame" : "{{650, 984}, {200, 32}}", "spellchecking_type" : "default", "class" : "TextField", "uuid" : "A24BDFFA-ECB0-46E0-B242-81DB95DB7804", "alignment" : "left", "text" : "7: I keep thinking of other painful events", "autocorrection_type" : "default", "name" : "textfield16", "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 1144}, {548, 32}}", "class" : "TextField", "attributes" : { "font_size" : 17, "frame" : "{{650, 984}, {200, 32}}", "spellchecking_type" : "default", "class" : "TextField", "uuid" : "6A06AFAD-6E87-40EB-97DD-47D333DC150F", "alignment" : "left", "text" : "6: I become afraid that the pain will get worse", "autocorrection_type" : "default", "name" : "textfield17", "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 1797}, {548, 34}}", "class" : "Slider", "attributes" : { "uuid" : "0424305D-2F2A-42F9-9BAF-0E81CB61D5AA", "frame" : "{{650, 983}, {200, 34}}", "value" : 0.5, "class" : "Slider", "name" : "slider1", "flex" : "W" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 1708}, {548, 34}}", "class" : "Slider", "attributes" : { "uuid" : "5949E0DF-C026-4450-A199-792F15FC3F82", "frame" : "{{650, 983}, {200, 34}}", "value" : 0.5, "class" : "Slider", "name" : "slider2", "flex" : "W" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 1616}, {548, 34}}", "class" : "Slider", "attributes" : { "uuid" : "98EA3CFF-D04B-46EE-8390-DED4517DA353", "frame" : "{{650, 983}, {200, 34}}", "value" : 0.5, "class" : "Slider", "name" : "slider3", "flex" : "W" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 1542}, {548, 34}}", "class" : "Slider", "attributes" : { "uuid" : "E75F66B1-01F6-46AE-AFBA-6F647997806E", "frame" : "{{650, 983}, {200, 34}}", "value" : 0.5, "class" : "Slider", "name" : "slider4", "flex" : "W" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 1454}, {548, 34}}", "class" : "Slider", "attributes" : { "uuid" : "FA53502D-F58E-4A37-B286-BDE604B65EFA", "frame" : "{{650, 983}, {200, 34}}", "value" : 0.5, "class" : "Slider", "name" : "slider5", "flex" : "W" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 1363}, {548, 34}}", "class" : "Slider", "attributes" : { "uuid" : "4E57FE3C-576C-4D9E-A452-D8D1FCE02C1C", "frame" : "{{650, 983}, {200, 34}}", "value" : 0.5, "class" : "Slider", "name" : "slider6", "flex" : "W" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 1268}, {548, 34}}", "class" : "Slider", "attributes" : { "uuid" : "9A42FE87-486F-4A06-BDBE-C88E1E4619F2", "frame" : "{{650, 983}, {200, 34}}", "value" : 0.5, "class" : "Slider", "name" : "slider7", "flex" : "W" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 1177}, {548, 34}}", "class" : "Slider", "attributes" : { "uuid" : "7F837CC8-E169-4463-82E7-12399910C67F", "frame" : "{{650, 983}, {200, 34}}", "value" : 0.5, "class" : "Slider", "name" : "slider8", "flex" : "W" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 1080}, {548, 34}}", "class" : "Slider", "attributes" : { "uuid" : "61042D5C-40E6-48AA-9761-83D03C7E70A6", "frame" : "{{650, 983}, {200, 34}}", "value" : 0.5, "class" : "Slider", "name" : "slider9", "flex" : "W" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 995}, {548, 34}}", "class" : "Slider", "attributes" : { "uuid" : "208BE845-F613-4847-92AF-F1770912D25C", "frame" : "{{650, 983}, {200, 34}}", "value" : 0.5, "class" : "Slider", "name" : "slider10", "flex" : "W" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 901}, {548, 34}}", "class" : "Slider", "attributes" : { "uuid" : "93159499-A34B-4F68-A4F3-ACBC07E3EBA0", "frame" : "{{650, 983}, {200, 34}}", "value" : 0.5, "class" : "Slider", "name" : "slider11", "flex" : "W" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 811}, {548, 34}}", "class" : "Slider", "attributes" : { "uuid" : "E3AB86D2-5592-4189-9BEB-AE97983D6C6E", "frame" : "{{650, 983}, {200, 34}}", "value" : 0.5, "class" : "Slider", "name" : "slider12", "flex" : "W" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 731}, {548, 34}}", "class" : "Slider", "attributes" : { "uuid" : "0DCAE395-0FA2-41A4-B94D-1C93FFB378E7", "frame" : "{{650, 983}, {200, 34}}", "value" : 0.5, "class" : "Slider", "name" : "slider13", "flex" : "W" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{55, 411}, {742, 54}}", "class" : "Label", "attributes" : { "border_width" : 5, "font_size" : 18, "alignment" : "center", "frame" : "{{425, 1584}, {150, 32}}", "uuid" : "BE8C6C9D-9720-4910-8FBE-469E4C25D95A", "background_color" : "RGBA(1.000000,0.415686,0.415686,1.000000)", "corner_radius" : 0, "class" : "Label", "text" : "Please complete the following 13 questions using the slider under each one. Move the white disk to the right to increase your score according to the following scale:", "name" : "label3", "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 543}, {548, 34}}", "class" : "Slider", "attributes" : { "uuid" : "E89FFBEC-9C28-4332-A34D-D26CA56A546D", "frame" : "{{400, 1583}, {200, 34}}", "value" : 0.5, "class" : "Slider", "name" : "slider14", "flex" : "W" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 513}, {548, 32}}", "class" : "TextField", "attributes" : { "name" : "textfield18", "frame" : "{{400, 1584}, {200, 32}}", "spellchecking_type" : "default", "class" : "TextField", "uuid" : "C8B04EC7-455B-4F4A-A9EE-E4575AB5AEAB", "alignment" : "left", "text" : "not at all — a slight degree — a moderate degree —a severe degree — all the time", "autocorrection_type" : "default", "font_size" : 14, "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{320, 647}, {222, 32}}", "class" : "Label", "attributes" : { "name" : "label4", "frame" : "{{425, 1584}, {150, 32}}", "uuid" : "C52CC6AE-7D36-4518-AFCB-61F46EEBD133", "class" : "Label", "alignment" : "center", "text" : "Questions", "background_color" : "RGBA(1.000000,1.000000,0.791667,1.000000)", "font_size" : 18, "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 1424}, {548, 32}}", "class" : "TextField", "attributes" : { "name" : "textfield19", "frame" : "{{400, 1584}, {200, 32}}", "spellchecking_type" : "default", "class" : "TextField", "uuid" : "9D34715A-B6CF-4C81-84E5-A4D2ECCD75F2", "alignment" : "left", "text" : "9: I can’t seem to keep it out of my mind", "autocorrection_type" : "default", "font_size" : 17, "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{47, 1332}, {548, 32}}", "class" : "TextField", "attributes" : { "name" : "textfield20", "frame" : "{{400, 1584}, {200, 32}}", "spellchecking_type" : "default", "class" : "TextField", "uuid" : "E32F686F-710A-4D2B-8905-BF7196360529", "alignment" : "left", "text" : "8: I anxiously want the pain to go away", "autocorrection_type" : "default", "font_size" : 17, "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{55, 280}, {742, 90}}", "class" : "Label", "attributes" : { "name" : "label2", "frame" : "{{425, 1684}, {150, 32}}", "uuid" : "3FC36B72-F248-4623-867F-308A1249B285", "class" : "Label", "alignment" : "left", "text" : "We are interested in the types of thoughts and feelings that you have when you are in pain. Listed below are thirteen statements describing different thoughts and feelings that may be associated with pain. Using the following scale, please indicate the degree to which you have these thoughts and feelings when you are experiencing pain", "background_color" : "RGBA(1.000000,1.000000,0.792157,1.000000)", "font_size" : 18, "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{630, 543}, {150, 32}}", "class" : "Label", "attributes" : { "font_size" : 18, "frame" : "{{425, 1684}, {150, 32}}", "uuid" : "E5D10801-5257-468C-A139-B536D2D3BC06", "class" : "Label", "alignment" : "left", "text" : "label", "name" : "label1", "font_name" : "<System>" }, "selected" : false }, { "nodes" : [ ], "frame" : "{{603, 495}, {80, 32}}", "class" : "Button", "attributes" : { "action" : "tf_action", "frame" : "{{460, 1684}, {80, 32}}", "title" : "Button", "uuid" : "0AFB75A6-4025-42B9-AE78-11BA5F2A3350", "class" : "Button", "name" : "button1", "font_size" : 15 }, "selected" : false } ], "frame" : "{{6, 114}, {900, 2300}}", "class" : "ScrollView", "attributes" : { "frame" : "{{-40, -40}, {320, 320}}", "uuid" : "0F732419-4C87-4B27-9D5F-68D25420E271", "background_color" : "RGBA(0.749020,1.000000,1.000000,1.000000)", "content_height" : 3400, "class" : "ScrollView", "content_width" : 1000, "name" : "scrollview1" }, "selected" : false } ], "frame" : "{{0, 0}, {900, 2300}}", "class" : "View", "attributes" : { "name" : "PAIN CATASTROPHIZING SCALE", "enabled" : true, "tint_color" : "RGBA(0.000000,0.478000,1.000000,1.000000)", "border_color" : "RGBA(0.000000,0.000000,0.000000,1.000000)", "background_color" : "RGBA(1.000000,1.000000,1.000000,1.000000)", "flex" : "" }, "selected" : false
}
]// -
@shp What doesn't work? As you did not post your .py, it is difficult to help.
Your pyui works with my little script -
import ui
name = ""
def tf_action(sender):label1 = v["label1"] textfield1 = v["textfield1"] name = textfield1.text label1.text = str (name)
#button1= ui.Button(action = tf_action)
#button1.action = tf_action
v = ui.load_view()
sc = v['scrollview1']
for sv in v.subviews:
v.remove_subview(sv)
if sv != sc:
sc.add_subview(sv)v.present('sheet')
-
@shp
In your script, not v.present('sheet') but sc.present('sheet').
name not neededSee my little script, where I use unused instead of v and v instead of sc
import ui def tf_action(sender): v["label1"].text = v["textfield1"].text unused = ui.load_view() v = unused['scrollview1'] v.background_color = 'lightgray' for sv in unused.subviews: unused.remove_subview(sv) if sv != v: v.add_subview(sv) del unused v.present('sheet')
-
@shp said in Change a label to user entry info from text field with button:
Thanks Jon
So all my views (labels, buttons etc) are in scrollview1 which is on top of the inspector . This does appear to be a sub view of the inspector as this is how i access it. I created this through a pyui file. I can send the pyui file but it is quite large as there are lots of other objects on it (sliders etc).
Have i made an error in doing it this way. Is there a better way
Thanks
I think what you have was probably ok, but you just need to access things based on their correct location in the hierarchy. @cvp suggest you present the scrollview rather than the container view, which also probably would work, but you can have complex views with multiple layers, and the key is just to figure out where things really live.
There used to be a script that dumped out an indented view hierarchy showing the names and children of each view, which can help in this sort of situation.
Also, doing things in the console first can be very helpful. E.g.
print (v.subviews)I forget if the graphical debugger let's you see the subview of UI.views -- you could place a breakpoint and explore in the debugger which might help.
You could also create a utility function, which might be a tad slow if used repeatedly:
def find_subview(root, name): ''' find a first subview (or descendant subview) with the name name, underneath the root view.''' if root.name==name: return root else: for view in root.subviews: sv=find_subview(view, name) if sv: return sv def find_full_viewpath(view): ''' Return the path to a view by recursively walking up the view hierarchy. Eg root_view['scrollview1']['textview1']''' if view.parent: parent_path=find_full_viewpath(view.parent) else: parent_path = 'root_view' return parent_path + "['" + view.name + "']"
Thus you could use
print(find_full_subview(find_subview('textview1')))
To figure out the right way to refer to that view
-
@cvp v elegant code. Thanks
-
@JonB thanks Jon
Where would I put your suggestions in my code?
import ui
v = ui.load_view()
name = ""
def tf_action(sender):
global namelabel1= ui.Label() label1 = v["label1"] textfield1 = ui.TextField() textfield1 = v["textfield1"] name = textfield1.text label1.text = str (name)
button1= ui.Button(action = tf_action)
button1.action = tf_actionv=ui.load_view()
v.present('sheet')Thanks simon
-
This post is deleted!