Exemple #1
0
# -*- coding: utf-8 -*-

from pylibpointing import PointingDevice, DisplayDevice, TransferFunction
from pylibpointing import PointingDeviceManager, PointingDeviceDescriptor

import sys

def cb_man(desc, wasAdded):
	print desc
	print "was added" if wasAdded else "was removed"


pm = PointingDeviceManager()
PointingDevice.idle(100)
pm.addDeviceUpdateCallback(cb_man)

for desc in pm:
	print desc

"""
for desc in pm:
	print desc.devURI
	print desc.vendor, desc.product
	pdev = PointingDevice(desc.uri)
"""

pdev = PointingDevice("any:")
ddev = DisplayDevice.create("any:")
tfct = TransferFunction("system:", pdev, ddev)

def cb_fct(timestamp, dx, dy, button):
Exemple #2
0
# -*- coding: utf-8 -*-

from pylibpointing import PointingDevice, DisplayDevice, TransferFunction

import sys

try:
    pdev=PointingDevice.create(sys.argv[1])
except:
    pdev=PointingDevice.create("any:?debugLevel=1")
    
ddev=DisplayDevice.create("any:")
tfct=TransferFunction.create("system:", pdev, ddev)

print("========= Testing DisplayDevice =========")
print("getURI: "+str(ddev.getURI()))
print("getURI (w/ property): "+str(ddev.uri))
print("getBounds (in pixels): "+str(ddev.getBounds()))
print("getBounds (w/ property):"+str(ddev.bounds))
print("getSize (in mm): "+str(ddev.getSize()))
print("getSize (w/ property): "+str(ddev.size))
print("getResolution (in ppi): "+str(ddev.getResolution()))
print("getResolution (w/ property): "+str(ddev.resolution))
print("getRefreshRate (in Hz): "+str(ddev.getRefreshRate()))
print("getRefreshRate (w/ property): "+str(ddev.refreshrate)) 
    
print("========= Testing PointingDevice =========")
class ObjectCB(object):
    def __init__(self, name):
        self.name_=name
        self.done_=False