mouse

pygame mouse.get_pos() not working

泄露秘密 提交于 2019-12-01 18:43:23
I can't get a very simple pygame script to work: import pygame class MainWindow(object): def __init__(self): pygame.init() pygame.display.set_caption('Game') pygame.mouse.set_visible(True) # pygame.mouse.set_visible(False) # this doesn't work either! screen = pygame.display.set_mode((640,480), 0, 32) pygame.mixer.init() while True: print pygame.mouse.get_pos() pygame.mixer.quit() pygame.quit() MainWindow() This just outputs (0,0) as I move the mouse around the window: (0, 0) (0, 0) (0, 0) (0, 0) (0, 0) Can anyone check this? Edit - fixed code: import pygame class MainWindow(object): def __init

Mouse move on element

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 18:29:41
问题 How i can move curser with jquery on an element when page loading is over? Thanks 回答1: This is not possible. I also disagree with highjacking the users mouse position, even if it were possible. If you did that to me as a user I would immediately leave your site. JavaScript was designed this way on purpose. Imagine the internet as it is today with all the crappy sites and exploits out there, mix in the ability to control the users mouse and you have a much worse experience. Let your users

Mouse move on element

天大地大妈咪最大 提交于 2019-12-01 18:25:30
How i can move curser with jquery on an element when page loading is over? Thanks This is not possible. I also disagree with highjacking the users mouse position, even if it were possible. If you did that to me as a user I would immediately leave your site. JavaScript was designed this way on purpose. Imagine the internet as it is today with all the crappy sites and exploits out there, mix in the ability to control the users mouse and you have a much worse experience. Let your users decided what they want to click on. barjo I think you can redraw the whole content of your web page so that the

Draw mouse pointer icon?

北城余情 提交于 2019-12-01 18:18:09
问题 I am coding little fun gadget. I want to be able to draw second (or more) mouse pointer icons at different location than the original mouse but to move it according to move of original mouse. I know how to track movement of the mouse but I dunno how to draw/redraw mouse pointer; can anyone help? 回答1: This could be done like: (1) grab the current mouse cursor from your application, using LoadCursor ( http://msdn.microsoft.com/en-us/library/aa924571.aspx ). Just specify NULL, and the cursor you

Setting mouse position without System.Windows.Forms

ⅰ亾dé卋堺 提交于 2019-12-01 17:44:06
Is there a way to manipulate the mouse position without using System.Windows.Forms.Cursor? Something like interop maybe? Reason for this is that we are using a specialized .NET subset which can't include System.Windows.Forms. oops my bad, read question too fast, heres the correct PInvoke call [DllImport("user32.dll")] static extern bool SetCursorPos(int X, int Y); Source: http://www.pinvoke.net/default.aspx/user32.setcursorpos private void MoveCursor() { // Set the Current cursor, move the cursor's Position, // and set its clipping rectangle to the form. this.Cursor = new Cursor(Cursor.Current

Draw mouse pointer icon?

白昼怎懂夜的黑 提交于 2019-12-01 17:41:45
I am coding little fun gadget. I want to be able to draw second (or more) mouse pointer icons at different location than the original mouse but to move it according to move of original mouse. I know how to track movement of the mouse but I dunno how to draw/redraw mouse pointer; can anyone help? This could be done like: (1) grab the current mouse cursor from your application, using LoadCursor ( http://msdn.microsoft.com/en-us/library/aa924571.aspx ). Just specify NULL, and the cursor you want. Or just load a bitmap for the cursor. Now, you have a bitmap. (2) Next step is to get the Device

Clicking mouse by sending messages

﹥>﹥吖頭↗ 提交于 2019-12-01 17:38:12
I'm trying to send mouse clicks to a program. As I don't want the mouse to move, I don't want to use SendInput or mouse_event, and because the window that should receive the clicks doesn't really use Buttons or other GUI events, I can't send messages to these buttons. I'm trying to get this working using SendMessage, but for some reason it doesn't work. Relevant code is (in C#, but tried Java with jnative as well), trying this on Vista [DllImport("user32.dll", CharSet=CharSet.Auto)] public static extern int SendMessage(IntPtr A_0, int A_1, int A_2, int A_3); static int WM_CLOSE = 0x10; static

Setting mouse position without System.Windows.Forms

孤人 提交于 2019-12-01 17:33:02
问题 Is there a way to manipulate the mouse position without using System.Windows.Forms.Cursor? Something like interop maybe? Reason for this is that we are using a specialized .NET subset which can't include System.Windows.Forms. 回答1: oops my bad, read question too fast, heres the correct PInvoke call [DllImport("user32.dll")] static extern bool SetCursorPos(int X, int Y); Source: http://www.pinvoke.net/default.aspx/user32.setcursorpos 回答2: private void MoveCursor() { // Set the Current cursor,

How to get cardinal mouse direction from mouse coordinates

故事扮演 提交于 2019-12-01 17:23:35
is it possible to get the mouse direction (Left, Right, Up, Down) based on mouse last position and current position? I have written the code to calculate the angle between two vectors but I am not sure if it is right. Can someone please point me to the right direction? public enum Direction { Left = 0, Right = 1, Down = 2, Up = 3 } private int lastX; private int lastY; private Direction direction; private void Form1_MouseDown(object sender, MouseEventArgs e) { lastX = e.X; lastY = e.Y; } private void Form1_MouseMove(object sender, MouseEventArgs e) { double angle = GetAngleBetweenVectors(lastX

Get mouse position when focus/blur events are fired? - Javascript/jQuery

萝らか妹 提交于 2019-12-01 16:42:29
问题 I'm using jquery to catpure an event: $('input').focus(function(e){ console.log( e.pageX, e.pageY ); }); This doesn't seem to work... any ideas on alternative ways to getting the mouse position? Help would be great, thanks :) 回答1: You can only get mouse coordinates using mouse events. If you want to capture the position of the mouse, you can use a global mousemove event listener, and store the coordinates in a set of variables, which can later be accessed by the focus function. Example: var