Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Register
    • Login

    Variable displayed in gui.MessageDialog ?

    PYTHON Development
    0
    5
    709
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          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

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            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")

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post