How do I determine the size of the stage in Snap? - size

How do I change or determine the size of the stage in Snap!?

In the Sensing category, you can choose the block. Below is an example from some of my code:

You can view and change the stage size from the Options menu (It looks like a sunburst symbol at the top of the IDE). There's an option called "Stage size..."
The default stage size is 480 by 360.

Related

What is mouseResponse threshold and why should we set a specific threshold?

I am beginner.I just started coding in codeacademy.In a certain level,the gave me a task which is relatate with threshold.So,my question is what is mouseResponse threshold and why should we set a specific threshold?
The actual question is give below:
1.
Three variables let you experiment with the animation physics: mouseResponseThreshold, friction, and rotationForce.
mouseResponseThreshold affects how close the mouse pointer needs to be to affect the dots that make up the letters. The larger the number, the more powerful the effect of the mouse interaction. Experiment with changing the mouseResponseThreshold to different numbers and running your code!
And the hint is "Try starting out by setting the threshold to 150."
What is mouseResponse threshold
This is distance from the mouse position to your target's position (in this case, the target is the "...dots that make up your letters").
Why should I set it
You need to set it so that your code knows at what distance it needs to do a certain operation.

How do I change position offset of wheelnav.js spreader title text

I have failed after several attempts, and massive search attempts (which I may have just failed at), to determine how to move the text in the spreader title to accommodate use of the spreaderStartAngle and spreaderSliceAngle settings, which allow for changing the wheel to smaller sizes (180 or 90 degree versions in my case).
The demo on the site shows the text moving away from the center (starting as a 360 degree circle) down to a quadrant. But in my own use, the re-positioning does not occur automatically, and I see no additional attributes being applied that would cause this.
I have dived into more detail and found that there is apparently something in the Rafael library that may being modified (when looking at the source on the demo page), but it is beyond my understanding on how to approach this via the existing methods.
Anything I have tried makes no change to the text location, which is always centered in what would have been a full circle, regardless of the actual spreader's start and end.
You can position spreader's title via the spreaderPathCustom property.
wheel.spreaderPathCustom = spreaderPath().PieSpreaderCustomization();
wheel.spreaderPathCustom.titleRadiusPercent = 0.58;
wheel.spreaderPathCustom.titleSliceAnglePercent = 0.45;
PieSpreaderCustomization belongs to PieSpreader. The above values of titleRadiusPercent and titleSliceAnglePercent are suitable for 90 degree.

JSX (Photoshop) - document resolution in dpi

I'm working with a jsx script in Photoshop that resizes images to a specific size. The resolution is set at 200 dpi. After running the script, I can check this under Image > Image Size.
Problem is, depending on the image, it initially tends to show the resolution in dots/cm instead of dots/inch. The number itself is correct either way, but I'd like to see it mentioned there as the latter. Is there a way to realize this in JSX?
Thanks!
J
The easy way is to open your Info Panel by going to Window > Info, and then click on the x/y coordinates dropdown in the Info Panel and select inches. The dropdown is the + toward the lower-left of the panel, with the little down arrow at the bottom right of the + symbol (The plus is actually an x axis and y axis representing a coordinate plane). After that, when you check under Image > Image Size, it should show you all information in inches instead of centimeters. This should also show you inches anywhere else you look in Photoshop's interface, too, such as the rulers.
An exception would be that when using selection tools, such as the marquee tool with a setting like "fixed size" selected, you can override the units setting by typing in another unit in the Width and Height sections at the top of the window. You can even mix and match units, making a precise selection that is, for example, exactly 250 pixels (px in the Width setting) by 30 points (pt in the Height setting). And when you check your image size, it should still show you results in inches.
And finally, to answer your question as it was asked, the following code will change your rulerUnits preference without opening the Info Panel.
#target Photoshop
preferences.rulerUnits = Units.INCHES;
Note that if you want to write other scripts, you can change the rulerUnits to whatever units the script calls for, and then at the end of the script put your units back the way you had them.
#target Photoshop
// Save the original rulerUnits setting to a variable
var originalRulerUnits = preferences.rulerUnits;
// Change the rulerUnits to Inches
preferences.rulerUnits = Units.INCHES;
//
// Do magical scripty stuff here...
//
// Restore the original setting
preferences.rulerUnits = originalRulerUnits;
// List of rulerUnits settings available
// Units.CM
// Units.INCHES
// Units.MM
// Units.PERCENT
// Units.PICAS
// Units.PIXELS
// Units.POINTS

PyGTK: Is there a method to calculate the best size for a window?

Most of my GUI programming was done in Java, where you could use a .pack() method that would set the preferred size the window should have. I'm learning PyGTK now and wondering if such a thing exists in it.
You don't need a pack method. if you don't set a size, the window will adjust to its minimum size.
You can use window.set_size_request(-1,-1) to unset any previous size.
Unfortunately... not that I know of. I use the following trick that uses a variety of GTK and GDK methods to work out the screen size of the current monitor at app startup and resizes the root window to have a certain proportion of fill.
Note that root is a GtkWindow. You could, of course, have two values for SCREEN_FILL for horizontal and vertical fill.
SCREEN_FILL = 0.7
class MainApp(object):
def set_initial_size(self):
screen = self.root.get_screen()
monitor = screen.get_monitor_at_window(self.root.get_window())
geom = screen.get_monitor_geometry(monitor)
self.root.set_resize_mode(gtk.RESIZE_QUEUE)
self.root.resize(
int(geom.width * SCREEN_FILL),
int(geom.height * SCREEN_FILL))

size of node with shape=circle

i'm trying to set the size of the nodes this way:
controller[shape=circle,width=.5,label="Controller",style=filled,fillcolor="#8EC13A"];
But all three nodes are with different size. How can i set fixed size?
From the DOT Guide http://www.graphviz.org/pdf/dotguide.pdf on page 4 it says the following:
When drawn, a
node’s actual size is the greater of the requested size and the area needed for its text
label, unless fixedsize=true, in which case the width and height values
are enforced.
Thus you simply need to add fixedsize=true to your code