1
$\begingroup$

I wrote down some problem, but suddenly have a stuck. Consider following code :

 Manipulate[Graphics[{Orange,Line[{a[{[1]],a[[2]]}],Line[{a[[2]],w}],
 Line[a[[1]],w]}],{Red,Point[w],Point[a[[1]]],Point[a[[2]]]}],
 {{a,{{-1, 0}, {5, 0}}}, Locator}, {w, {0, 5}, {5, 7}]

Now I've wanted to change the color of lines with ColorSlider. Remove Red and add Setting[ColorSlider[Red]]. But that doesn't get me a ColorSlider.

I tried something different, but there was only mistakes. Please give me an example of right writing way!

Sorry for terrible code and (maybe) easy answer. I'm just a newcomer.

$\endgroup$
  • $\begingroup$ Your code does not run. Please fix syntax errors. $\endgroup$ – Edmund May 23 '18 at 23:27
1
$\begingroup$
Manipulate[Graphics[{col1, Line[a], Line[{a[[2]], w}], Line[{a[[1]], w}],
   col2, PointSize[Large], Point[w], Point[a]}, PlotRange -> {{-7, 7}, {-5, 7}}], 
 {{a, {{-1, 0}, {5, 0}}}, Locator}, {w, {0, 5}, {5, 7}}, 
 {{col1, Orange}, ColorSlider}, {{col2, Red}, ColorSlider}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.