Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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
    • Login

    How to make a GUI for getting user inputs for my python script?

    General Talk
    5
    5
    1.0k
    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.
    • delizadeD
      delizade
      last edited by

      Hello,
      I realized that I have 5 different "change name" scripts for special needs. I need an interface that I can get some inputs from that and use it in a single script. For example suffix text, prefix text, and some checkboxes in a single panel.

      how can I do that? As far as I learned there are some gui functions for only one input type like:

      inputString=gui.InputDialog()
      
      

      I need a panel that will contain different type of multiple inputs. Is it possible?

      1 Reply Last reply Reply Quote 0
      • CairynC
        Cairyn
        last edited by

        Yes. But you need to define your own dialog class. Consider the class GeDialog here:
        https://developers.maxon.net/docs/py/2023_2/modules/c4d.gui/GeDialog/index.html
        Derive your own class from that and use the methods listed on that page to construct your own GUI and your own responders.

        1 Reply Last reply Reply Quote 1
        • M
          m_adam
          last edited by

          Hi @delizade as @Cairyn pointed out you should implement a GeDialog to create a dialog.
          The creation of the dialog is done within the CreateLayout method, where you need to call AddEditText to add some text input. The first parameter is an ID(int) that is used to identify the gadget. You are free to choose what you want but they should be unique in your dialog. You can retrieve the value of such input with GetString and the id used on the creation. If you want to know when the value change, you can override the Command method, which is called for each Gadget change with the ID of the gadget.

          Find more information about GeDialog in the C++ Manual, don't be afraid, the code is really adaptable to Python but this manual have some context that could help you to understand the whole logic of GeDialog. And finally find some example of GeDialog in the Python Github repository.

          Cheers,
          Maxime.

          MAXON SDK Specialist

          Development Blog, MAXON Registered Developer

          1 Reply Last reply Reply Quote 1
          • delizadeD
            delizade
            last edited by

            thank you @Cairyn @m_adam

            1 Reply Last reply Reply Quote 0
            • ferdinandF
              ferdinand
              last edited by

              Hello @delizade,

              without further questions or replies, we will consider this topic as solved by Monday, the 30th and flag it accordingly.

              Thank you for your understanding,
              Ferdinand

              MAXON SDK Specialist
              developers.maxon.net

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