-
Notifications
You must be signed in to change notification settings - Fork 182
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
[WIP] Up to Date ColorPicker UI Element #651
base: master
Are you sure you want to change the base?
Conversation
Update: I see now this is still a draft, sorry for rushing. but please consider my notes while you implement this. Hello @saran820, Also, the side of the picker is very small, and no way to control its size while initialization. |
Hi @m-agour, thank you for your reply. |
Thank you!
Yeah, not rush on this.
Looks good! |
Hi @saran820, Thank you for doing this. @ganimtron-10 and @xtanion will get back to you as soon as possible |
Hi, apologies for the whole thing, I was trying to reply but that happened. Thank you @skoudoro! I will update in case of any updates. |
Hi, so I have been able to manage the change in color of the Colorpicker Square through the Hue Bar. But this change in color does not change the color of the shape in the picture. I feel I might be missing some important aspects during testing. Kindly guide me with the same. from fury import ui, window
from fury.data import fetch_viz_icons
import sys
cp = ui.ColorPicker(side=300, position=(0, 0))
rect = ui.Rectangle2D(size=(100, 100), position=(400, 400))
def change_hue(rect):
color = cp.current_hue()
rect.on_change = change_hue
current_size = (800, 800)
show_manager = window.ShowManager(size=current_size,
title="Colorpicker on Rectangle")
show_manager.scene.add(cp)
show_manager.scene.add(rect)
interactive = True
if interactive:
show_manager.start()
window.record(show_manager.scene, size=current_size, out_path="viz_colorpicker.png") |
Hello @saran820 , Here in your recent code some points to be noted are:
Solutions: I am currently not having access to my pc, so I was unable to share the modified code. |
Hi @saran820 ,
With that being said, there is a problem with the color (I suspect the interpolation issue we discussed) see below the selected color is not the same color on the rect |
Hi @ganimtron-10 and @m-agour, thank you for the insights. I will look into it too and update in case of any progress. |
self.ColorSelectionSquare._add_to_scene(scene) # this line was changed | ||
self.pointer._add_to_scene(scene) # this line was changed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @saran820 ,
I am not sure if you are still working on it or not but I figured out why the interaction wasn't working for Rectangle2D
.
If you change these lines of code as suggested, the below code would work.
self.ColorSelectionSquare._add_to_scene(scene) # this line was changed | |
self.pointer._add_to_scene(scene) # this line was changed | |
self.ColorSelectionSquare.add_to_scene(scene) # this line was changed | |
self.pointer.add_to_scene(scene) # this line was changed |
Modified Code:
from fury import ui, window
from fury.data import fetch_viz_icons
import sys
import numpy as np
cp = ui.ColorPicker(side=300, position=(0, 0))
rect = ui.Rectangle2D(size=(100, 100), position=(400, 400))
def change_rect_color(color_picker, r, g, b):
rect.color = np.asarray(color_picker.hsv2rgb(color_picker.current_hue, color_picker.current_saturation,
color_picker.current_value)) / 255
cp.on_change = change_rect_color
current_size = (800, 800)
show_manager = window.ShowManager(size=current_size,
title="Colorpicker on Rectangle")
show_manager.scene.add(cp)
show_manager.scene.add(rect)
interactive = True
if interactive:
show_manager.start()
window.record(show_manager.scene, size=current_size,
out_path="viz_colorpicker.png")
This PR is adding ColorPicker based on the older PR #20.
Missing components:
Guidance is needed regarding interactivity. I have resolved the errors which stem from older versions. However, the ColorPicker is displayed on the window but has no responsiveness.
This was the code I used to get the above window: