[Mi...] Posted August 11, 2022 Share Posted August 11, 2022 Hi, Quite happily scripting away but I want to display a variable in a dialogue box. For example.... Point {variable} is not computed! <OK> <CANCEL> Is this possible? Link to comment Share on other sites More sharing options...
[1b...] Posted August 11, 2022 Share Posted August 11, 2022 Here is a simple message box that you can pass a variable to. Clicking "Ok" returns None, and "Cancel" exits the script # -*- coding: utf-8 -*- import gom def message_box(message=''): dialog=gom.script.sys.create_user_defined_dialog (content='<dialog>' \ '<title>*</title>' \ '<control id="OkCancel"/>' \ '<position>automatic</position>' \ '<sizemode>fixed</sizemode>' \ '<size width="300" height="300"/>' \ '<content rows="1" columns="1">' \ '<widget rowspan="1" columnspan="1" type="display::text" row="0" column="0">' \ '<name>message</name>' \ '<tooltip></tooltip>' \ '<text></text>' \ '<wordwrap>true</wordwrap>' \ '</widget>' \ '</content>' \ '</dialog>') dialog.message.text = message gom.script.sys.show_user_defined_dialog (dialog=dialog) return dialog.result.message if __name__ == '__main__': # #your code goes here # print(message_box('hello world!')) Link to comment Share on other sites More sharing options...
[Mi...] Posted August 11, 2022 Author Share Posted August 11, 2022 Thanks Robert, i will give that a try. I had been trying to use the 'Insert-Dialog' function in the script editor then using 'insert expression' function. Everything looked great but when my script runs I just get "Unknown Keyword" displayed on my dialogue box. I know my variable is declared.... I even printed it to the immediate window..... so a little confused. I will re-visit it tomorrow with fresh eyes..... Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in