MCPcopy Create free account
hub / github.com/cztomczak/cefpython / getHandle

Method getHandle

examples/qt.py:242–267  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

240 self.browser.SetClientHandler(FocusHandler(self))
241
242 def getHandle(self):
243 if self.hidden_window:
244 # PyQt5 on Linux
245 return int(self.hidden_window.winId())
246 try:
247 # PyQt4 and PyQt5
248 return int(self.winId())
249 except:
250 # PySide:
251 # | QWidget.winId() returns <PyCObject object at 0x02FD8788>
252 # | Converting it to int using ctypes.
253 if sys.version_info[0] == 2:
254 # Python 2
255 ctypes.pythonapi.PyCObject_AsVoidPtr.restype = (
256 ctypes.c_void_p)
257 ctypes.pythonapi.PyCObject_AsVoidPtr.argtypes = (
258 [ctypes.py_object])
259 return ctypes.pythonapi.PyCObject_AsVoidPtr(self.winId())
260 else:
261 # Python 3
262 ctypes.pythonapi.PyCapsule_GetPointer.restype = (
263 ctypes.c_void_p)
264 ctypes.pythonapi.PyCapsule_GetPointer.argtypes = (
265 [ctypes.py_object])
266 return ctypes.pythonapi.PyCapsule_GetPointer(
267 self.winId(), None)
268
269 def moveEvent(self, _):
270 self.x = 0

Callers 4

focusInEventMethod · 0.95
embedBrowserMethod · 0.95
moveEventMethod · 0.95
resizeEventMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected