I have a script for a splash screen that asks users to point to input and output folders. All seems to be working well except I’m having some trouble passing data from the local variable folderPath to the global variables inputPath and outputPath. It seems pretty straightforward but I think I’m misusing or missing some self references. I’m a fairly experienced GH user but have only recently started programming with python in Rhino so I’m sure its a syntax error somewhere but I can’t seem to debug this. I’m also not sure I can initialize an empty string like I’ve done.
The script is something like this:
# Imports inputPath = "" outputPath = "" # SampleEtoRoomNumber dialog class class SplashScreen(forms.Dialog[bool]): # Dialog box Class initializer def __init__(self): # Initialize dialog box # Create the Input button self.InputButton = forms.Button(Text = 'INPUT FOLDER') self.InputButton.Click += self.OnInputButtonClick # Create the Output button self.OutputButton = forms.Button(Text = 'OUTPUT FOLDER') self.OutputButton.Click += self.OnOutputButtonClick # Create the default button # Create the abort button # Create an Image View # Create a table layout and add all the controls # Set the dialog content # Start of the class functions # Input button click handler def OnInputButtonClick(self,sender,e): Rhino.UI.EtoExtensions.PushPickButton(self,self.PickInputPath) # Outputbutton click handler def OnOutputButtonClick(self,sender,e): Rhino.UI.EtoExtensions.PushPickButton(self,self.PickOutputPath) def PickInputPath(self,sender,e): folderPath = rs.BrowseForFolder("Pick Input Folder") inputPath = folderPath def PickOutputPath(self,sender,e): folderPath = rs.BrowseForFolder("Pick Output Folder") outputPath = folderPath # Close button click handler # OK button click handler # The script that will be using the dialog.
Any advice / recommendations will be very helpful.