1
$\begingroup$

I am writing a short GUIKit script with one TextField widget that takes the path of the image and a button widget which imports the image. The problem I have is passing the local values from the button widget to an ImageLabel widget to display the image. Testing the image variable in the ImageLabel widget with something like ImageDimensions[img] does not work showing that the `img variable is not associated with the image data.

Here's what I have written so far by looking at the examples online.

GUIRunModal[
 Widget[
  "Frame", {"title" -> "Segmentation Competition",
   Widget["Panel",
    {
     Widget["TextField", {"columns" -> 10}, Name -> "path"],
     Widget["Button", {"text" -> "open",
       BindEvent["action", Script[Module[{path},
          p = ToExpression@PropertyValue[{"path", "text"}];
          img = Import[p];
          Print[ImageDimensions[img]]
          ]]]}, Name -> "button"],
     Widget["ImageLabel", {"data" -> Script[Module[{button},
          p = ToExpression@PropertyValue[{"button", "image"}],
          Print[ImageDimensions[p]]
          ]]}, Name -> "imgDisplay"]
     }]
   }]
 ] 

Thank you.

Regards,

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.