FAQ Database Discussion Community


Opencv: detect mouse position clicking over a picture

python-2.7,opencv,mouse
I have this code in which I simply display an image using OpenCV: import numpy as np import cv2 class LoadImage: def loadImage(self): self.img=cv2.imread('photo.png') cv2.imshow('Test',self.img) self.pressedkey=cv2.waitKey(0) # Wait for ESC key to exit if self.pressedkey==27: cv2.destroyAllWindows() # Start of the main program here if __name__=="__main__": LI=LoadImage() LI.loadImage() Once the window...

buttons only react to clicks/touches when clicking/touching to the right of them

unity3d,click,touch,2d,mouse
I'm making a 2D game in Unity3D for android. Right now I'm making buttons. And this buttons does not react clicks/touched properly. I've got same issue with mouse clicks and touches both. Every button has trigger boxcollider with a same size as an object. BUT buttons react only when I...

WINAPI: capture mouse click in a ListBox for adding new items

winapi,listbox,click,mouse
I have a Windows application with a ListBox inside a Dialog. What I want to do is to get a notification when the user clicks in an empty area of the listbox and then add an item that I would get from a new dialog. How can this be done?...

OpenCV: how to draw continously with a mouse?

python,python-2.7,opencv,drawing,mouse
I modified a simple program taken from OpenCV documentation. I simply want to draw using the mouse pointer continuously. For the moment I succeeded to draw, but not in a continuous way unless if I move too slowly the mouse cursor. Code: import cv2 import numpy as np drawing=False #...

Disable mouse cursors on entire page using CSS

css,mouse,chromium-embedded
I want to remove the mouse cursor on the entire page. In Chromium 13.0 the following was working well. But now after an upgrade to Chromium 40.0 it is no longer working. On the one hand the mouse cursor is visible and on the other hand the user cannot use...

In Java, my MouseMotionListener and MouseListener is detecting clicks, but not movement

java,swing,mouse
so I am creating a java game and and here is my mouse's clicks are being detected but the mouseMoved is not being run at all. There is a print statement in the method which never gets run. I am really stuck because since the clicks are being registered across...

How to check if Mouse is available in XNA - Monogame

c#,xna,mouse,monogame,win-universal-app
I'm using Monogame to develop an universal app for Windows Store and Windows Phone. I know that is possible to check if a TouchPanel is available and I'm looking for a method that do the same thing with a mouse. I can't ignore the fact that a mouse is not...

Ignore all new incoming mousewheel messages while event is being handled

delphi,custom-controls,mouse,vcl,mousewheel
I am using some custom combobox control derived from TCustomControl and I am handling mouse events. Let's call it TMyComboBox. I am handling TMyComboBox.OnChange and doing some operations which takes some time to finish (approx. 200ms) (doing some external hardware changes). Because I also implemented mouse wheel I am able...

JavaScript - event.which always return 1 for hovering

javascript,jquery,hover,mouse,mouseclick-event
I would like to hover & mouse left click at the same time on a <div> but event.which always returns 1 : $('#element2').mouseenter(function(event) { switch (event.which) { case 1: alert('Left Mouse pressed.'); break; case 2: alert('Middle Mouse pressed.'); break; case 3: alert('Right Mouse pressed.'); break; default: alert('You have a strange...

c# move picturebox from an array of picturebox up when you hover mouse

c#,wpf,mouse,picturebox
I'm working on C# windows form. I have an array of picturebox, displayed on the form. The array has the size of 13, and they're all side by side. How can I make it so that when I click on a picturebox, it is moved up by let's say +20...

speech recognition for mouse left click in windows form using in c#

c#,mouse,speech-recognition
I am trying to coding to mouse left click in windows form. i want to do the left click of mouse anywhere on the screen when i say "left click". I have tried some codes but it gives errors here is the code: public Form1() { InitializeComponent(); this.KeyPreview = true;...

Can't get SendInput() to work

c#,visual-studio-2013,mouse,pinvoke,sendinput
I'm kind of desperate. I have been trying for hours now, but I just can't get SendInput() to work. To be honest, I can't even get it to be recognized. It always says: Error 1 The type or namespace name 'INPUT' could not be found (are you missing a using...

Opencv draw a rectangle in a picture were never shown

python-3.x,callback,mouse,opencv3.0,drawrectangle
Hey everybody i have some trouble using opencv 3.x and python 3.x. What i want to do is to draw a basic rectangle in a picture but the rectangle will never be drawn. I read this similar thread but it doesn't helped me with my fault. Python OpenCV: mouse callback...

How to write a MouseListener for JavaFX

javafx,mouseevent,java-8,mouse,mouselistener
I want to write a little game where I schoot from an object to a specific direction on a JavaFX Panel using my mouse position. I want to turn a Line in the direction where my Mouse is. Line line = new Line(startPosX, startPosY, mouseDirectionX, mouseDirectionY); How can I do...

Click the mouse to continue python 2

python,mouseevent,mouse,rect
How can I continue the game when the player clicks on the mouse? I tried making a huge rectangle and then if rectangleRect.collidepoint(mousex,mousey): blablablabla I know for sure it can be done much easier, but I don't know how. Anyone got some suggestions?...

addEventListener to iFrame

javascript,jquery,events,mouse
I'm tryin to add event listener to mouseup inside iframe object: $("#myIFrame").contents().find("body").bind("mouseup", function() { //e.preventDefault(); //doesn't make difference alert('inside'); }); This doesn't work. Any ideas?...

Moving an item with the mouse on QGraphicsView / QGraphicsScene

c++,qt,graphics,mouse
I have a QGraphicsView area that displays some Item items. I would like to have mouse move implemented. class Item { public: Item(); void update(); int x, y; // position int z; // order - should correspond also to index in item list }; class Collection : public QGraphicsView {...

Matplotlib: Find a region on a graph by mouse click

python,matplotlib,coordinates,mouse,intervals
Suppose I have a program that plots sine and cosine functions. I want to be able to select a subinterval or region that is created by the graphs, such as π/4 < x < 5π/4 or -3π/4 < x < π/4. So if I have this: import numpy as np...

Unity mouse position to world position but just the Y pos

unity3d,position,mouse
Hello I am making a small game in the Unity game engine and now I cant get it done just to get the y position of my mouse to be converted to the world y position. Any ideas to solve this?(Programming in c#)

Mouse input problems in java

java,swing,timer,mouse
Edit: I have an application that uses a swing Timer to control when an action listener interface fires. The mouse logic works but occasionally will not detect a click. Below is my commented code. public class Board extends JPanel implements MouseListener, MouseMotionListener, ActionListener { private MainMenu mainMenu = new MainMenu();...

JavaFX Moving 3D objects with mouse on a virtual plane

3d,mouse,javafx-8,raycasting,javafx-3d
As I was creating my first 3D game in JavaFX - where you would be able to assemble ships from parts using the mouse. This presents a problem since JAVAFX seems to have no native metods that work for converting PerspectiveCamera screen 2D coordinates into the scene's 3D space. Here...

How to fillRect canvas grid cell depending on mouse position?

javascript,canvas,grid,position,mouse
I've pretty code about grid parameters depending on mouse coords. CANVAS GRID DEMO HERE I want to clear filled, selected(imoX/imoY) cell while mouse is outside the selected(imoX/imoY) cell. It should be like: onmouseover[CellNumberX] = fillRect() onmouseout[CellNumberX] = strokeRect() Any solutions ? Thanks....

Delphi - Simulate Click Animation

delphi,animation,click,mouse
This is my first post here on stackoverflow so forgive me for anything I'm doing wrong. I'm making a kind of guide to the users without any computer knowledge of my application where I show him how to use it by signalizing what he should do, more specifically where to...

Error in reading Ubuntu 14.04 mouse event file (/dev/input/event3) with java programmig

java,events,ubuntu,terminal,mouse
I want to handle mouse event in Linux terminal via java programming. I wrote two program via c++ and java that they do same process. when i use c++ programming to open and read file ("/dev/input/event3"-mouse event file), there is no problem while running executable file. (Ubuntu 14.04 terminal and...

Unity3d get Mouse Input Axis

c#,unity3d,mouse
I want to rotate a GameObject through mouse movement between -20° and +20°. I know that there's a possibility to grab the smoothed Input through Input.GetAxis("Horizontal"); and Input.GetAxis("Vertical"); which returns float values between -1 and 1 It would be nice if there would exist something like Input.GetMouseAxis("Horizontal"); or Input.GetMouseAxis("Horizontal");. But...

Java mouseReleased() method query

java,awt,mouse
I have taken the following code from a learning resource. When I run the applet, I notice that 'Up' is only displayed after having dragged the mouse. 'Up' is not displayed if a mouse button is pressed then released in the same location. Why is 'Up' not displayed in the...

Console wait until left mouse button down

c#,console,mouse,wait
I have the problem, that my console application wait at random points, until i press the left mouse button. The application is written in C#. I don't use ReadKey or something else in my application (Which even should wait for a key pressed not the mouse). Does anyone had similar...

Theoretically speaking, is this possible? [closed]

macros,mouse,twitch
Okay, so I have come up with an idea that is based loosely on TwitchPlaysPokemon, I won't go into huge detail as it is a new idea, but I will cover the basics. What I would be looking to do is have a program that can, in a game, move...

How do I control the camera in PyOpenGL using a mouse?

python,opengl,view,mouse,pyopengl
We need to make a 3D game in python so in my research I discovered PyOpenGL. After a bit of playing around with I became stumped on how to move the camera around. Give me some sample code and an explanation.

Taking mouse control in C# WPF

c#,wpf,mouse
I watnt o create a tutorial/guide inside in my application, creating a "demonstration". For this purpose, I need to capture the mouse of the computer, and to be able to move it and click with it. I want it to feel like if somebody else were there controling your computer....

Make the input wait for mouse or keyboard - Assembly Language

assembly,input,keyboard,mouse,simultaneous
I fixed my program, but now the loop seems to be stuck. Whenever I press u or d, it is stuck, but the mouse part works :) ; You may customize this and other start-up templates; ; The location of this template is c:\emu8086\inc\0_com_template.txt org 100h CLEAR MACRO MOV AX,0600H...

Xlib,C++ - Get Window Handle (SendEvent,…)

c++,linux,keyboard,mouse,capture
I am currently working with XLib in order to code an Application that can send Mouse and Keyboard Events to a certain window (Not display). I was able to send these Events to a window using The "window"-handle obtained by the "XGetInputFocus()" method. Unfortunately I need to get the window-handle...

How to make smoth elements dragging by mouse if their position set in percents?

javascript,html,mouse,move,elements
I doing elements dragging possibility in my page. User should drag any element with % or px set position. The dragging of px positioned elements works good, but the dragging of % positioned elements is too fast and element runs away from mouse. Which way I can fix this? I...

How to implement virtual mouse c#

c#,blob,mouse,aforge
I'm building application to detect laser movement and convert this movement to mouse event.I use System.Runtime.InteropServices.DllImport("user32.dll")] to work with mouse When it detects one laser point it work correctly and control mouse movement. I need it to work when it detects multiple lasers point which mean i need to have...

Getting a line that has the coordinates defined by the mouse location

c#,graphics,drawing,line,mouse
I'm trying to make a little graphics program that has a circle of diameter 100 on the screen and from the center of it, a line is coming out of it that is always attached to the mouse pointer until such time that the user does a click, and then...

FreePascal mouse input when using graph window?

graph,mouse,freepascal
GetMouseX does not work when using a graph window. uses wincert,graph,winmouse; var x,y:integer; Begin x:=GetMouseX; End. This gives me Error:Identifier not found "GetMouseX". Trying this with unit 'mouse' works in the console window, but not in the graphics window. Can anyone please help?...