Python - PyQT4 how to detect the mouse click position anywhere in the window?

后端 未结 2 1974
遥遥无期
遥遥无期 2020-12-10 03:32

I have 1024x768 resolution window, when there is a click or mouse over, i want to find the x, y values. How can i do that?

import sys
from PyQt4 import QtGui         


        
2条回答
  •  失恋的感觉
    2020-12-10 04:10

    The other way to get (x,y) coordinates:

    def mouseReleaseEvent(self, QMouseEvent):
        print('(', QMouseEvent.x(), ', ', QMouseEvent.y(), ')')
    

提交回复
热议问题