How To Assign A Variable To FillColor in Turtle - python-3.8

In my code I want to make a face which randomly generates a face color and an eye color. Whatever the first eye's eye color is, I want that to be the second one. What I did was I assigned the first eye's color to the variable pupil_color so it looked like this... pupil_color = t.fillcolor(random.choice(eye_colors) and then on the second eye color, I put t.fillcolor(pupil_color) but it didn't work.

Related

Colors[4] not showing color selection on Front Panel

I am trying to set the color of an indicator to different colors based on different values, like 1 = red, 2 = blue etc. Using guidance from a Youtube video (accessible using this link: https://www.youtube.com/watch?v=czUmPQmKmGU), I have created a Colors[4] control for the indicator I have after changing it to the "write" function.
The Problem on the front panel is that I am getting a control with numbers instead of a color box where I can select the colors to show based on the value. This was the control I got instead.
This is the control I am trying to achieve (below):
Is there any way that I can get the color box on my control instead of the number controls? I am not sure if it can be changed through a control on the front panel or something but what I have tried so far keeps leading me back to this problem.
Any advice is much appreciated
A color box control is just a U32 number (three bytes for RGB and one which is always 0), which is why that's what you get.
There is a right click plugin which adds a replace with color box option directly to the right click menu of unsigned 32 bit numbers, but I don't remember if it ships with LV or not.
If you don't have that, you can always just right click the indicator inside the cluster, select replace and navigate the palettes to find the color box. You can also copy a color box and then select the indicator and paste, which replaces the selected control.
The color[4] is actually an array of 4 colors (UInt32 as Yair said), that define 2 color gradients, one for the 'Off' state, and the other for the 'On' State of the control.
If you want to set the control's color, you will have to define all 4 of them.

Changing Label's Image According To Variable?

I'm trying to make (using Visual Basic) a rudimentary questionnaire that measures multiple attributes and stores their values in an array and afterwards measures the attributes on a scale of 1 to 10.Now I've had the dumb idea to use a label for every single value of every attribute, and highlighting the right number by changing the label's image to yellow, instead of white(basically making the area behind the number a different color).
Now here's the issue: I can't seem to find out how to change a label's background image with code, which is what I'm asking. (I'm guessing the command should look something like "Label1.image = >image path<")
Pretty simple.
If text = No then
Label.Text = No
Else
Label.Text = Yes
End IF
You just have to change the text value of the label which is .Text = Text you want
And if your trying to show images, you should use the image control in the tool box, not a label

QlikView - Bar Borders

I have a grouped bar chart in QlikView - the bars are displayed in different colors. Is it possible display the last bar in a group so that the border of the bar is red, and the middel of the bar is white?
Short answer; you can't do what you want to do.
You can individually set the thickness/presence of the bars but you can not change the colours of those borders. You will also need to set-up an expression for each you can not affect the border thickness based on the dimensions
And you can colour the bars as per the dimension quite effectively, so without bothering about the borders you can make the last bar always red, you just need to know the dimension you are working with
So this:
Will give you this:
Unfortunately not, within the bar chart object bars do not have a border.

Setting/manipulating color and line color for SimpleFillSymbol

I am trying to create a graphics layer over a designated area that has a background color and an opposing line color. I read on the API Documentation that the color parameter only applies when SimpleFillSymbol.style = "STYLE_SOLID". Is there a way to set a color when SimpleFillSymbol.style = "STYLE_FORWARD_DIAGONAL"?
So with my current need I need the background to be yellow with lines running through it.
restricted_areas.symbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_FORWARD_DIAGONAL, null, new Color([255, 255, 0]));
I simply get a background with lines but no color. Is there a way around this?
You can't set the color because the fill for SimpleFillSymbol.STYLE_FORWARD_DIAGONAL is an image
If you're using the Arcgis JSAPI from arcgis.com then the image is located here.
http://js.arcgis.com/3.15/esri/images/symbol/sfs/forwarddiagonal.png?version=4
So using SimpleFillSymbol with the STYLE_FORWARD_DIAGONAL style is really just a convenience function for a PictureFillSymbol with a specific picture.
To change and customize the color of the fill you'll have to use a PictureFillSymbol and then you can use whatever image and color you want.

How to obtain opposite colour

I have a custom coloured background that the user can choose, this however means when they change the colour, the label is invisible because it is the same as the background and I do not want this. The code I have is: opacityLabel.textColor = bgView.backgroundColor; In this bit of code the colour is the same at the start but doesn't change when I adjust the background colour, I also need the colour to continually change with the background colour, I was wondering what I could replace with "=" to make the label do the opposite colour. I can't do "!=" because that means is not equal to rather than opposite! If you can't do it this way could you provide me with a way of doing it?
The first thing you'll need to do is calculate the opposite colour to the backgroundColor, and then assign it to the textColor property.
To do this you'll need to use the getRed:green:blue:alpha: method on backgroundColor. This will give you values between 0.0 and 1.0 for each component of your colour.
Then use the UIColor class method colorWithRed:green:blue:alpha: to create a new UIColor, but use (1.0 - component value) for each of the components.
Then finally assign your new colour to opacityLabel.textColor