Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/10/2010 at 04:58, xxxxxxxx wrote:
User Information: Cinema 4D Version: 12 Platform: Windows ; Language(s) : PYTHON ;
--------- Hello there,
I am trying to get a grip on GUI interfaces within Python for C4D. Unfortunately just now learning python (and coding) so I still am not able to understand the SDK in a way that I can code right away.
Is there a example somwhere over making a simple GeDialog with lets say one input value? so that I understand the structure that is nessesary?
thanks a lot
Jops (who is trying not to flood this nice forum with newbie questions)
On 28/10/2010 at 05:09, xxxxxxxx wrote:
Hi Jops,
here is a small example for you. I hope this helps:
import c4d from c4d import gui #Welcome to the world of Python GROUP_ID1=1000 TEXTBOX=1001 BUTTON1=1002 BUTTON2=1003 class ExampleDlg(gui.GeDialog) : def CreateLayout(self) : #creat the layout of the dialog self.GroupBegin(GROUP_ID1, c4d.BFH_SCALEFIT, 3, 1) self.AddEditText(TEXTBOX, c4d.BFH_SCALEFIT) self.AddButton(BUTTON1, c4d.BFH_SCALE, name="MessadeDialog") self.AddButton(BUTTON2, c4d.BFH_SCALE, name="Close") self.GroupEnd() return True def InitValues(self) : #initiate the gadgets with values self.SetString(TEXTBOX, "Hello World!") return True def Command(self, id, msg) : #handle user input if id==BUTTON1: gui.MessageDialog(self.GetString(TEXTBOX)) elif id==BUTTON2: self.Close() return True dlg = ExampleDlg() dlg.Open(c4d.DLG_TYPE_MODAL, defaultw=300, defaulth=50)
Cheers, Sebastian
On 28/10/2010 at 05:52, xxxxxxxx wrote:
Hello Sebastian,
that is great, thanks a lot!!! may I put you example in Per-Anders Python Wiki?
all The best Jops
On 28/10/2010 at 06:05, xxxxxxxx wrote:
Sure, do with the code what ever you want.
On 28/10/2010 at 06:28, xxxxxxxx wrote:
if you have time you might answer me one more question:
if I define the dialog as a async dialog it just pops up and closes again. even if I put it into the mail loop.
Is there a trick or is there more to it?
thanks again Jops
On 28/10/2010 at 07:20, xxxxxxxx wrote:
Asynchronous dialogs can just be used in plugins (in combination with CommandData).
On 28/10/2010 at 14:54, xxxxxxxx wrote:
is it on principle possible to code a python plugin with plug ID and Asynchronous dialogs?
On 03/11/2010 at 03:13, xxxxxxxx wrote:
Originally posted by xxxxxxxx is it on principle possible to code a python plugin with plug ID and Asynchronous dialogs?
Originally posted by xxxxxxxx
Yes, that's possible.
cheers, Matthias
On 01/11/2017 at 12:43, xxxxxxxx wrote:
Originally posted by xxxxxxxx def Command(self, id, msg) : #handle user input if id==BUTTON1: gui.MessageDialog(self.GetString(TEXTBOX)) elif id==BUTTON2: self.Close() return True
def Command(self, id, msg) : #handle user input if id==BUTTON1: gui.MessageDialog(self.GetString(TEXTBOX)) elif id==BUTTON2: self.Close() return True
The buttons aren't working for me. Nothing happens when I click on them.
On 02/11/2017 at 10:29, xxxxxxxx wrote:
Hi,
welcome to the Plugin Café forums
I think, you'd need to post a bit more of your code, the Command() function doesn't look wrong to me.
We have a few examples making use of GeDialog in our GitHub repository. The simplest, basically with two buttons in a GeDialog (just like the example above) is Py-TextureBaker.pyp.