fury icon indicating copy to clipboard operation
fury copied to clipboard

drop_down_menu icon flaw in ComboBox2D

Open lej0hn opened this issue 3 years ago • 3 comments

Description

When a choice is made from the combobox, the icon changes not once but a few times, creating a flickering effect. This happens only when the combobox is added on a tabUI.

Way to reproduce

The following example is taken from the Tab_UI tutorial.

  • Run the following code
  • Click on the tab to open dropdown menu
  • Choose a color from the list
from fury import ui, window, actor
import numpy as np
from fury.data import fetch_viz_icons


fetch_viz_icons()

colors = {
    "Violet": (0.6, 0, 0.8),
    "Indigo": (0.3, 0, 0.5),
    "Blue": (0, 0, 1),
    "Green": (0, 1, 0),
    "Yellow": (1, 1, 0),
    "Orange": (1, 0.5, 0),
    "Red": (1, 0, 0)
}

tab_ui = ui.TabUI(position=(49, 94), size=(300, 300), nb_tabs=1 , draggable=True)
color_combobox = ui.ComboBox2D(items=list(colors.keys()),
                               placeholder="Choose Text Color",
                               size=(250, 150), draggable=True)

tab_ui.add_element(0, color_combobox, (0.1, 0.3))
label = ui.TextBlock2D(
    position=(600, 300), font_size=40, color=(1, 0.5, 0),
    justification="center", vertical_justification="top",
    text="FURY rocks!!!")                               

def change_color(combobox):
    label.color = colors[combobox.selected_text]

tab_ui.tabs[0].title = "Colors"
color_combobox.on_change = change_color
sm = window.ShowManager(size=(800, 500), title="Viz Tab")
sm.scene.add(tab_ui,label)
interactive = True

if interactive:
    sm.start()

Operating system and versions

{'fury_version': '0.8.0', 'pkg_path': 'C:\Users\giannhs\AppData\Local\Programs\Python\Python39\lib\site-packages\fury', 'commit_hash': 'b937ff3418e7c64b0fa89921a54c083ff78dc055', 'sys_version': '3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)]', 'sys_executable': 'C:\Users\giannhs\AppData\Local\Programs\Python\Python39\python.exe', 'sys_platform': 'win32', 'numpy_version': '1.20.1', 'scipy_version': '1.6.1', 'vtk_version': '9.1.0', 'matplotlib_version': '3.3.4', 'dipy_version': '1.5.0'}

lej0hn avatar Mar 29 '22 17:03 lej0hn

Thank you for the feedback @lej0hn, we will look into it

skoudoro avatar Apr 04 '22 16:04 skoudoro

Hello @lej0hn thank you for the bug report. Unfortunately, I am not able to reproduce the bug on my end could you please share a screen recording of what it looks like on your end? Thank you!

Nibba2018 avatar Jul 21 '22 07:07 Nibba2018

Unfortunately, I am not able to reproduce the bug on my end could you please share a screen recording of what it looks like on your end? Thank you!

When you select one choice, you can see the flickering effect for the arrow icon.

skoudoro avatar Jul 21 '22 14:07 skoudoro

you just want to remove the flickering effect or make the toggle button also go close when colour is selected from the list I think flickering is happening because the menu_toggle_callback function is calling more than once which causes the drop_down_button.next_icon function to call twice causing flickering

please hint me something which I'm missing

coder-abhi07 avatar Mar 07 '23 12:03 coder-abhi07

if nobody is working on this issue please assign this issue to me this will be going to be my first contribution

coder-abhi07 avatar Mar 07 '23 12:03 coder-abhi07