AddStaticText Insert String defined by variable as text name in Python
Hey guys,
I'm having a hard time trying to figure out the right order in which I'm trying to use a string obtained by a variable andu use the string infomation as a StaticText. Here's my current working code minus the AddStaticText part which works under the CreateLayout Definition, but it would run that before obtaining the information I would want it to, so I moved it under my Command Definition. Any small insight would be very grateful!
import c4d
from c4d import gui, plugins, bitmaps, documents
class GUI(gui.GeDialog):
""" Creates the main graphical user interface of the plug-in """
BUTTON_ID = 1001
Checkbox_ID = 1002
ComboBox_ID = 1003
AddChild_1 = 1004
TextEdit = 1005
def CreateLayout(self):
self.SetTitle("CAV MVR IMPORTER") # Set dialog title
self.AddButton(self.BUTTON_ID, c4d.BFH_LEFT | c4d.BFV_TOP, 100, 25, "Close Dialog")
self.AddCheckbox(self.Checkbox_ID, c4d.BFH_LEFT | c4d.BFV_TOP, 25, 25, "Checkbox")
self.AddComboBox(self.ComboBox_ID, 0 | 0, 100, 25, True, True)
self.AddChild(self.ComboBox_ID, self.AddChild_1, "Drop Down 1")
#self.AddStaticText(self.TextEdit, 0 | 0, 100, 25, "Test Text", 1)
def Command(self, id, msg):
if id == 1001:
fn = c4d.storage.LoadDialog()
print fn
if fn == str:
self.AddStaticText(self.TextEdit, 0 | 0, 100, 25, fn, 1)
def main():
# Test dialog
diag = GUI()
diag.Open(dlgtype=c4d.DLG_TYPE_MODAL, defaultw=1000, defaulth=400)
# Execute main()
if __name__ == '__main__':
main()
Cheers!
MattG