Solved Python Script Gui: Use EditSlider Get Float


i want to use EditSlider in my script to control weight, range (0.00 - 1.00) or other .i search in SDK and use "GeDialog.AddEditSlider(id, flags, initw=80, inith=0)",how can i change the range and get float just like set "user data"?

thank you!

Hi @mike, first of all I would like to remind you to read and use the Q&A functionnality.

Regarding your question, here is an example of a basic GeDialog, which make use to SetFloat to define a range.

import c4d

class MonDlg( c4d.gui.GeDialog):
    idSlider = 1000
    idButton = 1001

    # Create the Layout
    def CreateLayout(self):
        self.AddEditSlider(self.idSlider, c4d.BFH_SCALE|c4d.BFV_SCALE, initw=100, inith=20)
        self.AddButton(self.idButton, c4d.BFH_SCALE|c4d.BFV_SCALE, initw=100, inith=20,name = 'Get Value')	
        return True

    # Called after CreateLayout
    def InitValues(self):
        self.SetFloat(self.idSlider, 0.25, min=0.0, max=1.0, step=0.01, min2=0.0, max2=0.0)
        return True

    # Called for each interaction from a widget
    def Command(self, id, msg):
        if id == self.idButton:
            print self.GetFloat(self.idSlider)
        return True

def main():
    dlg = MonDlg()

if __name__=='__main__':

If you have any questions please let me know.

@m_adam Thank you for your help!

Hi, @mike if the previous post solves your issue, please mark it as the correct answers. It will switch the topic as solved. To do so please read Q&A functionality.
Of course, if you didn't test my previous post, or may have follow-up questions, do not mark as solved and take as much time as you need to ask us. But if there is nothing more to add please mark your topic as solved.