What does the turtle onscreenclick return in Python? How do I make an area a 'button'? - python-turtle

Does turtle.onscreenclick return the x- & y-coordinates? Also, how do I make a rectangle where if I click within it changes the color of the rectangle?

turtle.onscreenclick binds the function in the brackets to the given key.
turtle.onscreenclick(fun, 1) where 1 is the left click and 3 is the right click.
Explanation:
https://docs.python.org/3/library/turtle.html#turtle.onscreenclick

Related

get the value of the cell in the line + n in the same column by comparing the boolean respective cell

I feel stuck on an issue of which I am sure I will not find the answer because I might not have the right terms for my research on the search engine and it is rare that I am in such a blockage.
However, here is my issue: on another sheet i want to get a sum of value. On the picture below you can see few blocks represented by green circles and each block has a cell with check box in red circle and a value to get append to a sum by a blue circle. And this what i want, i want to get in my sum each blue circle value only if in the same block the check box is checked. This seem easy but my issue isn't there. I could get a condition if the check box is checked take the value for each block but maybe i want more block. This is my issue, i could get more block or someone else could get more or less block.
image
So i need a formula dynamic to get each future value in blue circle where futur red circle could be checked.
I hope my issue could be understand.
try:
=SUM(FILTER(R7:R100; W4:W97=TRUE))

How can I recognise programmatically when an up/down arrow is drawn on a chart when arrow objects are hidden?

I know how to draw an object arrow on the chart, which I usually do like this:
ObjectCreate(0,"prevHigh",OBJ_ARROW_DOWN,0,Time[0],High[highestCandle]);
ObjectSetInteger(0, "prevHigh", OBJPROP_COLOR, clrRed);
Now I have an indicator which (I didn't code myself and is a .ex4 file which) draws up/down arrows on the chart as seen in the image (https://imgur.com/a/8yG0suw).
How can I when for example a Magenta down arrow has been drawn and the candle (index) at which it is drawn?
Please note that the arrows not in the list of objects on the chart
Q : "How can I recognise programmatically when an up/down arrow is drawn on a chart?"
Given the facts above, your test ought evaluate the moment the CustomIndicator ( via a published / used iCustom()-call signature ) by checking it as it goes from EMPTY_VALUE to any value != EMPTY_VALUE.
Given the CustomIndicator is a closed source ( *.ex4 ) you may need to check, if it did set its own ( hidden from our sight ) value, other than a current visible EMPTY_VALUE, yet this "re-calibration" will work, after you get a few manual tests of the CustomIndicator values for bars, that do not show any arrow - like for the 2020-Apr-08 09:30 et al v/s the displayed arrows are not the MQL4-Objects on their own, they are the closed-source CustomIndicator's SetIndexStyle() / SetIndexArrow() by-products, thus not inspectable either in the Object-List, or in the *.mq4 source-code.
Yet, detectable

iOS - Find white pixels/area enclosed by a black curve and create path

Using Swift methods touchBegan, touchMoved and touchEnded I save the touch points and than I draw a line using UIGraphicsGetCurrentContext() with methods beginPath(), move(to: Point), addLine(to: Point) and strokePath().
This line is repeated on 4 quadrants plus their negative values, therefore 8 lines are drawn.
Here is an example:
Example image
I save this drawing as an Image when the user taps the tick (Done green button at top-right) for later manipulations.
I wonder if it's possible to create e closed path/shape with white pixels enclosed by the black lines. I want to fill the white area with custom color when the user touches inside it.
The shape is created by user input and I have no idea how it would look like.
Would be thankful to whoever finds the time to give it's contribute.
Thank you
Maybe what you want is the "Flood Fill" algorithm, please see the article.

Modify interaction - How to get the segment which has been hovered

I am using openlayers-3 modify interaction to edit vector layers. When a polygon/polyline is being edited, if mouse is close to a line segment, a small circle is drawn and dragging it creates a new vertex or moves an existing vertex, depending on where on the segment I was hovering.
Now, sometimes this is very difficult to understand if I am hovering on an existing vertex, or on middle of a segment. I have thought about two solutions to the problem:
Highlight the segment I am hovering with a different style so that I
can see its edges.
When hovering on an vertex, style the small
circle with a different style.
Is there a way to achieve any of the two?
It can be done changing the interaction condition like:
var selectPointerMove_Highlight = new ol.interaction.Select({
condition: ol.events.condition.pointerMove
});
map.addInteraction(selectPointerMove_Highlight);
I have an online example.

iOS SDK Triangle ASA or AAS (angle-side-angle or angle-angle-side) formula

I am looking to spin a UILabel 45 degrees (to the right) on it's anchor point (the center of the UILabel) and put it on the right of the table cell so it looks like a diagonal ribbon across the table cell, from the bottom-right of the cell up and toward the left until it hits the top of the cell.
To do this (in a diagonal) I do the following:
Get the height of the table cell. This gives me (in an triangle with sides a,b,c) "c". So, "c" is one leg of the triangle. Because I want it to be a 45 degree triangle that also gives me leg "a" of the triangle.
Now the easy part: I know all three angles of this triangle. "C" (angle across from side c) is 45 degrees, "B" (angle across from side "b") is 90 (cos it is the right top corner of the cell's content view...and we know those are right-angles. Angle "A" (angle across from side "a") is also 45.
Side "b" is the side i am having fits with... What formula do i use to get length of side "b" such that it is wide enough to go (when diagonal) across the height of the cell's contentview from the bottom right until it hits the top of the cell? I know for a 44pt high cell, the length of this UILabel when diagonal should be around 60-ish pts...but the formula is escaping me.
When using a online calculator Triangle Calculator and using the drop-down for angle-angle-side, I feed in the following numbers: A: 45,B: 45, C: 44, and this gives: 62.2254 for the side length...which is fine...but my table cell is not always 44pts high so i need a formula i can put in objective-c. I have read up on the Law of Sines, but my High-School Trig years are SO behind me.
I hope all this is clear. If not, please let me know. Thanks in advance.
If I understand you correctly you will always have triangle with one right angle and two other 45 degrees. If short side (both of them will have same length) of such triangle is X, then long side is square root from 2*X*X

Resources