Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Max and min clamping arguments in add_input_float and add_input_int are ignored #1229

Closed
christuart opened this issue Sep 8, 2021 · 2 comments · Fixed by #1235
Closed

Max and min clamping arguments in add_input_float and add_input_int are ignored #1229

christuart opened this issue Sep 8, 2021 · 2 comments · Fixed by #1235
Labels
state: ready Fixed/Added and will be present in an upcoming release

Comments

@christuart
Copy link

Version of Dear PyGui

Version: 0.8.64 on Python 3.7
Operating System: Scientific Linux 7.4

My Issue/Question

When I use dpg.add_input_float or dpg.add_input_int and specify min_clamped=False or max_clamped=False, these are ignored.

To Reproduce

Run this minimal reproducing solution and note that the two inputs boxes are clamped between 0 and 100 even though min_clamped and max_clamped were set False.

Then click the button below each and see they are no longer clamped, proving that it is possible to use min_clamped and max_clamped once out of startup.

Then click the final button and see that even out of startup, a dynamically added float or int input ignores max_clamped=False, min_clamped=False. These parameters of add_input_int and add_input_float are simply ignored.

Note also the printed output of the item configuration at each step, showing that max_clamped and min_clamped arguments were immediately ignored and set to True each time add_input_int or add_input_float was called.

Expected behavior

The configuration keywords in add_input_float and add_input_int should do exactly the same as when later applied in set_item_configuration.

Standalone, minimal, complete and verifiable example

import dearpygui.dearpygui as dpg

with dpg.window() as window_id:
    dpg.set_primary_window(window_id, True)
    # Add input float which shouldn't be clamped
    user_input_item = dpg.add_input_float(
        max_clamped=False,
        min_clamped=False,
    )
    print('Float before unclamping', dpg.get_item_configuration(user_input_item))

    # Add button to actually unclamp it
    def callback():
        dpg.configure_item(user_input_item,
            max_clamped=False,
            min_clamped=False,
        )
        print('Float after unclamping', dpg.get_item_configuration(user_input_item))
    dpg.add_button(label='unclamp float', callback=callback)

    # Add input int which shouldn't be clamped
    user_input_item = dpg.add_input_int(
        max_clamped=False,
        min_clamped=False,
    )
    print('Int before unclamping', dpg.get_item_configuration(user_input_item))

    # Add button to actually unclamp it
    def callback():
        dpg.configure_item(user_input_item,
            max_clamped=False,
            min_clamped=False,
        )
        print('Int after unclamping', dpg.get_item_configuration(user_input_item))
    dpg.add_button(label='unclamp int', callback=callback)

    # Add button that adds a float input outside of startup
    def callback():
        user_input_item = dpg.add_input_float(
            max_clamped=False,
            min_clamped=False,
            parent = window_id,
        )
        print('Newly added float', dpg.get_item_configuration(user_input_item))
        user_input_item = dpg.add_input_int(
            max_clamped=False,
            min_clamped=False,
            parent = window_id,
        )
        print('Newly added int', dpg.get_item_configuration(user_input_item))
    dpg.add_button(label='add another float and int', callback=callback)

dpg.start_dearpygui()
Pcothren added a commit that referenced this issue Sep 11, 2021
removing forced override of clamped when min/max set. When both clamped and a min/max is passed at the same time priority is given to clamped
@Pcothren Pcothren mentioned this issue Sep 11, 2021
@Pcothren Pcothren added state: ready Fixed/Added and will be present in an upcoming release and removed need to verify labels Sep 11, 2021
@Pcothren
Copy link
Collaborator

thank you for the complete issue report!

hoffstadt pushed a commit that referenced this issue Sep 11, 2021
removing forced override of clamped when min/max set. When both clamped and a min/max is passed at the same time priority is given to clamped
@christuart
Copy link
Author

Thanks! Speedy :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: ready Fixed/Added and will be present in an upcoming release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants