Is it possible to create a popup window after Dynamo Player has been run using Dynamo player and Data-Shapes?

Hello everyone,

I am using the Data-Shapes package to gather input from users that helps them display plumbing calculations. Data-Shapes is working flawlessly in terms of popping up and asking for input once users run the script through Dynamo player. I am wanting to know if it is possible for another popup window to appear after completing the calculations that displays what is in my final watch node. I have attached two images showing the overall node layout and the final output I would like displayed in a popup window. I can find a lot of information online about gathering input types but nothing about displaying output. Thanks for the help in advance!

Data%20Shapes%20Help%202Data%20Shapes%20Help%201

Popup windows can be triggered via some python as shown on this thread:

2 Likes

@christianjgentry I think this is what you are after. You can add the following code to your python script:

image

import clr

clr.AddReference("System.Windows.Forms")
from System.Windows.Forms import Form,Label

def popup(text):
	form = Form()
	form.Width = 300
	form.Height = 100	
	label = Label()
	label.Text = text
	label.Width = 280
	label.Height = 70
	label.Parent = form	
	form.ShowDialog()
	
Text="\n".join(IN[0])
popup(Text)
11 Likes

Wow, this is exactly the solution that I was looking for. Thank you for your help @salvatoredragotta! I will look into the System.Windows class further as this seems very powerful. Thank you again.

1 Like

Hi @salvatoredragotta ,

I am using your script which is functioning perfectly as described. I was just looking to add a little more control to the popup; such as CenterScreen, but I cannot seem to work out where to insert the code.

I’m afraid I have no Python knowledge but I tried to apply some intuition and help from Google.

I have come to the conclusion that the position should be defined when the Form is being initially shown. Therefore I tried the following:

clr.AddReference(“System.Windows.Forms”)
from System.Windows.Forms.FormStartPosition = CenterScreen import Form,Label

Forgive my ignorance, but what am I doing wrong? Many examples online seem to be defining the location in a ‘protected void’. But I tried using this method & couldn’t work out where this should be located in the script.

Thanks

@haganjake2 Please start a new topic. Thanks!