2011-12-30 10 views
3

是否有可能通過wxpython獲取對象在點(x,y)?獲取對象點? wxpython

buton=wx.Button(self, id=wx.ID_ANY, label='object',pos=(10,10), size=(175, 28)) 
print GetObjectAtPoint(10,10) # this function does not exist 

如果有任何與上述類似,那將是很好的,或者如果有,我應該怎麼做的建議。甚至,如果有任何諸如GetObjectsInRange(x1,y1,x2,y2)

回答

2

wx.FindWindowAtPoint(PT)

另外

GenericFindWindowAtPoint(PT)

FindWindowAtPointer()

http://www.wxpython.org/docs/api/

+0

這是否與面板兼容? – thelost 2011-12-30 21:25:27

+1

FindWindowAtPoint()是一個模塊函數,不是wxPanel中的成員函數 嘗試 wx.FindWindowAtPoint((0,0)) – 2012-01-01 15:37:28

2

您是否嘗試過FindWindowsAtPoint()?這是我能想到的唯一的事情就是這樣。您也可以查看Widget Inspection Tool,以瞭解它在點擊它們時如何獲取有關窗口小部件的信息。

+0

我不認爲這種方法適用於面板?還是呢?我試過了,它返回一個錯誤,'MyPanel'對象沒有屬性'FindWindowAtPoint' – thelost 2011-12-30 16:52:59