Psychtoolbox scale slider - slider

I'm trying to make a slider for a simple scale where the user can see mouse movement ONLY in the horizontal axis (fixed y location on the horizontal scale).
In more detail: When the scale appears, I want the cursor to appear as a short vertical line (aka slider) in the center of the horizontal scale.
When the user moves the mouse, the slider should move accordingly on the horizontal axis (without reflecting any changes in the vertical axis, i.e. it should stay on the scale)
I'm stuck on both changing the appearance of the cursor to a vertical line slider and on limiting the cursor's movement to the horizontal axis.
Here's what I've tried:
I can successfully place the cursor with SetMouse.
I tried ShowCursor to change the appearance of the cursor, but this only has a few named options and the numbered ones are not portable across OSs ("mapping of numbers to shapes is operating system dependent"), which I need. Any other ideas on how to change the cursor to a vertical line slider?
As for limiting the movement to horizontal, I couldn't find any PTB functions that seem to do this. I did find some workarounds in Matlab to make user GUIs, but it seems these can't be used with PTB's screen. Any ideas would be great!
I'm a still very new to PTB so thank you so much for your help!

I wrote a function for exactly that called slideScale. If you want to see how it works see the test script.
The crucial thing for you is to create a loop, which runs until a click has been made and record the position of the cursor for instance with the function GetMouse(), which gives you the x- and y-coordinates of the cursor. Then, the only thing you basically need is to update the position of your vertical line using the x-coordinate you recorded with GetMouse() without changing the y-coordinates, for which you can just use a fixed value.

Related

How to stop resizing the graph axis in tableau?

I want to stop resizing the graph axis (x,y), if any filter on the data is used in tableau. Can anyone helpe with this?
Double click on the axis to edit its characteristics (or right click on it and choose edit axis)
By default, the axis upper and lower bounds are set automatically based on the range of data that appears. If you wish to fix one or both ends to a constant value, just change that setting in the axis editing dialog.
You’ll see a push-pin icon on the axis to remind you that the axis bounds are pinned. That reminder is useful because if there is data that is beyond the bounds of the axis, it will be clipped and not shown.
BTW, this is the exactly the same thing that happens when you zoom in on a map or chart, you’re pinning the axes to display only part of the region.

How to control matplotlib annotate (arrow more specifically) in terms of size of figure?

I'd like to draw arrows in my plots, iif there is enough size for the arrow to be displayed properly (ie, with arrow and tail in the right position). Is there any way to control this in code?
For a better explanations, here is the problem explained in 3 examples: in this 1st figure, the arrow shouldn't be displayed as the arrow should go from the dotted line to the solid black line, and in this case there is not enough space for a proper visualisation.
When the same image is zoomed, the arrow behaves correctly though:
Here goes a final example, with a figure in its normal size (without zoom) where the arrow behaves correctly and should be drawn.
In conclusion, in case 1 I would like the arrow not to be drawn (not enough space for a correct visualisation) and to be drawn in the other cases.

How to animate colors in an object in blender

I was making an magic ball in blendeR.I have made the uv sphere ball already and also i have added 5-6 different colors with the help of light sources.Now i want the colors to animated or move in an jiggly way like whirl.Please see the link something like this :
http://luisbc.deviantart.com/art/Magic-Ball-II-364636015
I just want to make the colors inside my ball to move/circulate in a way.I don't know how to use Automatic Key Frame as well as how to make the lights move in a direction in my ball.
Please help me out.
Thanks.
The basics of animation are -
Move to the frame that you want to specify a value.
Alter the value you want to animate.
Insert a keyframe for the value.
Repeat for other frames in the animation.
The Automatic keyframe option can automate step 3 - but it will only add keyframes to values that have already been keyed. That means you have to manually add the first keyframe for a value, then as you change the value new keys will be created. Remember that it creates a keyframe on the current frame for the altered value so change frames before changing anything.
In blender almost any value can be animated, that could be the location and/or rotation of an object, the texture mapping values for a material or the colour of the material.
You can press I to add a keyframe, in the 3Dview this will show a list of common choices for location/rotation/scale and combinations of each. For values found elsewhere it will key the value located under the cursor. You can also right click on a value and select Insert Keyframe.
For help using blender you will find blender.stackexchange a better place to ask for help.

How to build a Head Up Display in OpenSceneGraph that resizes depending on the screen's resolution?

I'm pretty new to OpenSceneGraph and I have the following problem:
I'm trying to build a 2D Head Up Display out of several images, so that it can resize depending on the screen's resolution. That means I have extra images for the corners and one image for the bar that connects the corners and so on.
Well, that's the idea. But I have no clue how to do that in OpenSceneGraph.
Can anybody help me?
So, when the window resizes, you'll get an event from osgViewer telling you about the change.
You need to resize your viewport when the window size changes, so your HUD geometry has some idea of what the pixel-size of the display is (most of the HUD examples setup for a nominal 1024x768 screen and then just let that stretch around as the window is resized, pretending like the new viewport is still 1024x768).
Once you've resized the viewpoer, you need to rearrange your geometry. Your corner pieces need to be laid out at the fixed pixel size you want them to always appear, then you need your connecting elements to change size, horizontally or vertically, to fill the space between the corner pieces. You usually rely on texture stretching or repeating to fill the space as the piece of geometry gets stretched.
If none of that makes any sense, I can describe more.

Rectangles & Parsing in vb.net

This is kinda....a two part question. The first one is much more important than the second one, both of these are in the same project, and in vb.net.
How can I constrain the bounds of a rectangle object, which is controlled by a mouse, so it cannot be drawn outside a PictureBox? It is kindof a standard lasso control, the user can click and drag and it will draw a box from the initial click point to the mouse's current location. The starting point is at (rectX,rectY), and the box is drawn to the bottom right using rectDimX and rectDimY (to set the width and height) to see how much of a change has occurred with the mouse. Basically, its what you get with a click and drag on a Windows desktop. The issue here is that the rectangle is able to be drawn outside the PictureBox it is being drawn on, and the next part of the code attempts to reference this location, and then fails with an OutOfMemory exception. This leads me to my second question:
How can I make the rectangle draw in more than the fourth quadrant, which is only positive numbers? If it goes anywhere else, it does not show the rectangle, though it does still have the correct values. I know i could code this four times based on starting location and mouse location, but that would be a huge hassle and a rewrite of the whole rectangle code.
Is there an easy solution for either of these? The first one is a much bigger hassle, as it will be very time consuming if there is no easy way.
Thanks for the help!
For the first part of your question, even if the user drags the mouse beyond the edge of your picture box, you don't have to use those coordinates for your drawing routine. Simply do something like
If (DrawingPoint.X > PictureBox.Right)
DrawingPoint.X = PictureBox.Right // Right-hand limit of picture box
End If
And similar for the Y direction.
As for the negative numbers while drawing, you want to translate screen coordinates to client area coordinates. Have a look at ScreenToClient and ClientToScreen.