taipy icon indicating copy to clipboard operation
taipy copied to clipboard

Make a slider in float type with a particular step value

Open heaynking opened this issue 1 year ago • 3 comments

I'm trying to make a slider in float type with a particular step value. How to make it?

I think it will be easier to use if there's a "step" property:

pressure = 0.05
with tgb.Page() as page:
    tgb.slider("{pressure}", min=0.01, max=0.1, step=0.01)

heaynking avatar Dec 31 '23 07:12 heaynking

You can code this, for example as a way to mimic what you want to do:

import taipy.gui.builder as tgb
from taipy.gui import Gui 

# create a list of string 0.1, 0.2, 0.3, ...
string_list = [str(i / 10) for i in range(1, 11)]

pressure = string_list[0]
with tgb.Page() as page:
    tgb.text("Slider:")
    tgb.slider("{pressure}", lov=string_list)

Gui(page).run()

We could add what you said with step directly to Taipy to make it easier. Let's discuss about it.

FlorianJacta avatar Jan 02 '24 13:01 FlorianJacta

I agree with this issue. We should align with the Python standards. For example, in NumPy, np.arange uses min, max and step with step defaulting to 1. This allows you to easily do both integer and float sliders

AlexandreSajus avatar Jan 12 '24 16:01 AlexandreSajus

Thank you for your response. I look forward to it being added!

heaynking avatar Jan 17 '24 07:01 heaynking

I want to work on this!

Satoshi-Sh avatar Feb 06 '24 18:02 Satoshi-Sh

@Satoshi-Sh I have assigned this issue to you. Here you can find how to contribute to Taipy.

FlorianJacta avatar Feb 07 '24 09:02 FlorianJacta

Thanks, @FlorianJacta . I need help with this PR, it would be nice if you could guide me. I made a draft pull request already. #800

I updated Slidebar.tsx to take step argument but it seems not working according to the test I wrote. I also struggled to set up formatted for this project.

Satoshi-Sh avatar Feb 07 '24 14:02 Satoshi-Sh

I commented your PR

FredLL-Avaiga avatar Feb 07 '24 15:02 FredLL-Avaiga

There is an issue with step function when used with markdown. see code below <|{vari}|slider|min=0|max=200|step=1|change_delay=2000|orientation=vert|on_change=sliderchange|> the code throws error and does not recognize step. when removed from code the slider functions normally.

pkinani avatar Jun 16 '24 14:06 pkinani

This feature appeared in 3.1. What Taipy version so you have?

I wasn't able to replicate the issue on 3.1.

FlorianJacta avatar Jun 17 '24 07:06 FlorianJacta

Hi, My version is 3.1.1

See the screenshot below

[cid:6635a724-9a3e-4ffb-ac1b-671cbd4dd264]

The above slider code runs even with this error shown in VSCode but step functionality does not work for slider.

Regards

Sent from Outlookhttp://aka.ms/weboutlook


From: Florian Jacta @.> Sent: Monday, June 17, 2024 12:50 PM To: Avaiga/taipy @.> Cc: pkinani @.>; Comment @.> Subject: Re: [Avaiga/taipy] Make a slider in float type with a particular step value (Issue #639)

This feature appeared in 3.1. What Taipy version so you have?

I wasn't able to replicate the issue on 3.1.

— Reply to this email directly, view it on GitHubhttps://github.com/Avaiga/taipy/issues/639#issuecomment-2172479953, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWDEU5SMUK4FP6ZXDPGO42LZH2E27AVCNFSM6AAAAABBIBZTR6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZSGQ3TSOJVGM. You are receiving this because you commented.Message ID: @.***>

pkinani avatar Jun 18 '24 04:06 pkinani

Hi, I cannot see your screenshot. Could you provide the code as well as the traceback?

FlorianJacta avatar Jun 18 '24 08:06 FlorianJacta

[cid:4fddf86e-110f-4109-a722-8eb79a37c84d]

The screenshot is given above. Step=5 is showing error! In the code. Screenshot file also attached.

Hope this helps

Sent from Outlookhttp://aka.ms/weboutlook


From: Florian Jacta @.> Sent: Tuesday, June 18, 2024 1:52 PM To: Avaiga/taipy @.> Cc: pkinani @.>; Comment @.> Subject: Re: [Avaiga/taipy] Make a slider in float type with a particular step value (Issue #639)

Hi, I cannot see your screenshot. Could you provide the code as well as the traceback?

— Reply to this email directly, view it on GitHubhttps://github.com/Avaiga/taipy/issues/639#issuecomment-2175502034, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWDEU5R5UJQELH2ZAO7LG63ZH7U5BAVCNFSM6AAAAABBIBZTR6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZVGUYDEMBTGQ. You are receiving this because you commented.Message ID: @.***>

pkinani avatar Jun 18 '24 15:06 pkinani

I see no screenshot.

image

I think you are using your emails to send these screenshots, which won't work. Try to go on GitHub directly.

FlorianJacta avatar Jun 18 '24 15:06 FlorianJacta

Screenshot sent via github

Sent from Outlookhttp://aka.ms/weboutlook


From: Florian Jacta @.> Sent: Tuesday, June 18, 2024 9:20 PM To: Avaiga/taipy @.> Cc: pkinani @.>; Comment @.> Subject: Re: [Avaiga/taipy] Make a slider in float type with a particular step value (Issue #639)

I see no screenshot.

image.png (view on web)https://github.com/Avaiga/taipy/assets/98709993/ac1d42f9-356d-4a0b-a076-c9901764e4fa

I think you are using your emails to send these screenshots, which won't work. Try to go on GitHub directly.

— Reply to this email directly, view it on GitHubhttps://github.com/Avaiga/taipy/issues/639#issuecomment-2176432476, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWDEU5TKT4DK7MICEYTISELZIBJMJAVCNFSM6AAAAABBIBZTR6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZWGQZTENBXGY. You are receiving this because you commented.Message ID: @.***>

pkinani avatar Jun 18 '24 15:06 pkinani

Issue created on github.

step function in slider not working #1428

Sent from Outlookhttp://aka.ms/weboutlook From: Florian Jacta @.> Sent: Tuesday, June 18, 2024 9:20 PM To: Avaiga/taipy @.> Cc: pkinani @.>; Comment @.> Subject: Re: [Avaiga/taipy] Make a slider in float type with a particular step value (Issue #639)

I see no screenshot.

image.png (view on web)https://github.com/Avaiga/taipy/assets/98709993/ac1d42f9-356d-4a0b-a076-c9901764e4fa

I think you are using your emails to send these screenshots, which won't work. Try to go on GitHub directly.

— Reply to this email directly, view it on GitHubhttps://github.com/Avaiga/taipy/issues/639#issuecomment-2176432476, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWDEU5TKT4DK7MICEYTISELZIBJMJAVCNFSM6AAAAABBIBZTR6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZWGQZTENBXGY. You are receiving this because you commented.Message ID: @.@.>>

pkinani avatar Jun 18 '24 16:06 pkinani