最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

dashboard - Taipy - notification duration based on recalculation time - position of notification - Stack Overflow

programmeradmin5浏览0评论

I built a taipy webapp to show several models. While toggling between different models, it takes some time to recalculate. If, while recalculating, you start clicking other buttons, the webapp sometimes gets stuck.

To avoid this, I added a notification (via the notify() function) which warns the user of the webapp not to click elsewhere while the app is recalculating.

My problem is now that it seems the duration that the notification is shown is a fixed time (in ms). Is it possible to make this duration dependent on the recalculating time (=so for the same time as the small circle in the right bottom of the screen is shown)?

My second problem is the position of the notification. I didn't find any option to move it for example to the center of the screen, which would make it more visible for the user. Is there already an option to do this?

    notify(state, notification_type = 'info', 
       message = "App is recalculating. Please wait and do not click elsewhere.",
       duration = 5000)

I built a taipy webapp to show several models. While toggling between different models, it takes some time to recalculate. If, while recalculating, you start clicking other buttons, the webapp sometimes gets stuck.

To avoid this, I added a notification (via the notify() function) which warns the user of the webapp not to click elsewhere while the app is recalculating.

My problem is now that it seems the duration that the notification is shown is a fixed time (in ms). Is it possible to make this duration dependent on the recalculating time (=so for the same time as the small circle in the right bottom of the screen is shown)?

My second problem is the position of the notification. I didn't find any option to move it for example to the center of the screen, which would make it more visible for the user. Is there already an option to do this?

    notify(state, notification_type = 'info', 
       message = "App is recalculating. Please wait and do not click elsewhere.",
       duration = 5000)
Share asked Mar 11 at 7:31 K_R_R_KK_R_R_K 153 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

I think what you are looking for is: hold_control and resume_control. This blocks your app with a dialog showing up with a message while a task is being done.

Here is an example:

import time

from taipy.gui import Gui
from taipy.gui import builder as tgb
from taipy.gui import hold_control, resume_control


def callback_with_hold(state):
    hold_control(state, message="Waiting")
    time.sleep(5)
    resume_control(state)


with tgb.Page() as hold_and_resume_page:
    tgb.text("# Hold and Resume control", mode="md")

    tgb.button("Trigger callback!", on_action=callback_with_hold)

if __name__ == "__main__":
    Gui(page=hold_and_resume_page).run(use_reloader=True, dark_mode=False, port=1234)

发布评论

评论列表(0)

  1. 暂无评论