Variable displayed in gui.MessageDialog ?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/02/2011 at 02:00, xxxxxxxx wrote:
Variable displayed in gui.MessageDialog ?
Something like
import c4d from c4d import gui def main() : counter = 123456 gui.MessageDialog(counter, ' Objects') if __name__=='__main__': main()
I know that the code obove is not working just to explain my trouble ...
thanks in advance
mogh -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/02/2011 at 03:02, xxxxxxxx wrote:
Hi mogh,
which message do you want to display? Try this:
gui.MessageDialog(counter + ' Objects') gui.MessageDialog(counter + ' Objects', c4d.GEMB_YESNOCANCEL)
Cheers, Seb
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/03/2011 at 23:10, xxxxxxxx wrote:
Hi Seb,
I still have problems with the code, it worked for a while and now its broken again.
The Python Console gives me:>
Traceback (most recent call last) :
File "<scriptmanager>", line 35, in <module>
File "<scriptmanager>", line 29, in main
TypeError: unsupported operand type(s) for +: 'int' and 'str'my script is:
import c4d from c4d import documents from c4d import gui def GetNextObject(op) : if op==None: return None return op.GetNext() def main() : c4d.CallCommand(1024314); # clear python console c4d.CallCommand(1022604); # open python console counter = 0 myobject = doc.GetFirstObject() if myobject==None: return while myobject: counter = counter + 1 myobject = GetNextObject(myobject) gui.MessageDialog(counter + ' Objects in root.') if __name__=='__main__': main()
thanks in advance
mogh -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/03/2011 at 23:39, xxxxxxxx wrote:
I dont think that gui element takes anything but text and an option setting
ie just text will work
try gui.MessageDialog(str(counter)+ " Objects")
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/03/2011 at 00:33, xxxxxxxx wrote:
Just to make you understand the console:
TypeError: unsupported operand type(s) for +: 'int' and 'str'
You can't add a string to an integer. As deepshade wrote, you have to convert the integer first with the str() - function.