> -----Ursprüngliche Nachricht-----
> Von: "Thomas Heller" <[EMAIL PROTECTED]>
> Gesendet: 22.09.08 09:01:13
> An: comtypes-users@lists.sourceforge.net
> Betreff: Re: [comtypes-users] Events for device not working since version 
> 0.3.2


> [Resending, the first answer seemed to get lost somewhere]
> 
> Malte Skarupke schrieb:
> > > I'm trying to get the 3D Space Navigator
> > > (http://www.3dconnexion.com/) to work in Python. I quickly found a
> > > solution using comtypes on the 3DConnexion developer forum: 
> > > http://www.3dconnexion.com/forum/viewtopic.php?t=984&start=30
> > > 
> > > However that solution only works with comtypes version 0.2.1. Any
> > > newer version will result in the events not registering.
> > > 
> > > 
> > > I believe, that this is enough output, because I believe the line
> > > "DEBUG:comtypes:Release <POINTER(ISensor) ptr=0x9f2170 at c14d50>"
> > > shows, where the bug originates. If you need any further testing, I
> > > would be glad to help.
> 
> Does it work when you keep a reference to the sensor object?  Something like 
> this:
> 
> >>> >>> import logging logging.basicConfig(level=logging.DEBUG) from
> >>> >>> comtypes.client import * x = CreateObject("TDxInput.Device") 
> >>> >>> x.Connect()
> 0
> >>> >>> s = x.sensor test = ShowEvents(s)
> >>> >>> 
> 
> -- Thanks, Thomas 
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> comtypes-users mailing list
> comtypes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/comtypes-users
> 


No, I'm afraid it still doesn't work. Now I get only the "Release 
<Pointer(IConnectionPointContainer)>" line however:


Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import logging
>>> logging.basicConfig(level=logging.DEBUG)
>>> from comtypes.client import *
DEBUG:comtypes:CoInitializeEx(None, 2)
INFO:comtypes.client._code_cache:Imported existing <module 'comtypes.gen' from 
'C:\Python25\lib\site-packages\comtypes\gen\__init__.pyc'>
INFO:comtypes.client._code_cache:Using writeable comtypes cache directory: 
'C:\Python25\lib\site-packages\comtypes\gen'
>>> x = CreateObject("TDxInput.Device")
DEBUG:comtypes.client:TDxInput.Device -> {82C5AB54-C92C-4D52-AAC5-27E25E22604C}
DEBUG:comtypes.client:CoCreateInstance({82C5AB54-C92C-4D52-AAC5-27E25E22604C}, 
clsctx=None, interface=None)
DEBUG:comtypes.client:GetBestInterface(<POINTER(IUnknown) ptr=0x9f3fc0 at 
c14cb0>)
DEBUG:comtypes.client:Does implement IProvideClassInfo
DEBUG:comtypes.client:Default interface is 
{CB3BF65E-0816-482A-BB11-64AF1E837812}
DEBUG:comtypes:Release <POINTER(IUnknown) ptr=0x9f3fc0 at c648a0>
DEBUG:comtypes.client._generate:GetModule(TLIBATTR(GUID={7858B9E0-5793-4BE4-9B53-661D922790D2},
 Version=1.0, LCID=0, FLags=0x8))
DEBUG:comtypes.client:Implements default interface from typeinfo <class 
'comtypes.gen._7858B9E0_5793_4BE4_9B53_661D922790D2_0_1_0.ISimpleDevice'>
DEBUG:comtypes.client:Final result is <POINTER(ISimpleDevice) ptr=0x9f3fc0 at 
136b170>
DEBUG:comtypes:Release <POINTER(IProvideClassInfo) ptr=0x9f68a8 at c64710>
DEBUG:comtypes:Release <POINTER(ITypeInfo) ptr=0x252644 at c64530>
DEBUG:comtypes:Release <POINTER(ITypeInfo) ptr=0x252670 at c64760>
DEBUG:comtypes:Release <POINTER(ITypeLib) ptr=0x251dd8 at c648a0>
DEBUG:comtypes:Release <POINTER(IUnknown) ptr=0x9f3fc0 at c14cb0>
>>> x.Connect()
0
>>> s = x.Sensor
DEBUG:comtypes.client:wrap_outparam(<POINTER(ISensor) ptr=0x9f2170 at c14cb0>)
>>> ShowEvents(s)
DEBUG:comtypes.client._events:<POINTER(ISensor) ptr=0x9f2170 at c14cb0> using 
sinkinterface <class 
'comtypes.gen._7858B9E0_5793_4BE4_9B53_661D922790D2_0_1_0._ISensorEvents'>
DEBUG:comtypes:Release <POINTER(IProvideClassInfo2) ptr=0x9f2194 at a91f80>
# event found: _ISensorEvents_SensorInput
DEBUG:comtypes.client._events:Start advise <class 
'comtypes.gen._7858B9E0_5793_4BE4_9B53_661D922790D2_0_1_0._ISensorEvents'>
DEBUG:comtypes._comobject:<comtypes.client._events.Sink object at 
0x00B46230>.QueryInterface({E6929A4A-6F41-46C6-9252-A8CC53472CB1}) -> S_OK
DEBUG:comtypes._comobject:1 active COM objects: Added   
<comtypes.client._events.Sink object at 0x00B46230>
DEBUG:comtypes._comobject:<comtypes.client._events.Sink object at 
0x00B46230>.AddRef() -> 1
DEBUG:comtypes:Release <POINTER(IConnectionPointContainer) ptr=0x9f2174 at 
136b260>
<comtypes.client._events._AdviseConnection object at 0x00A9CCB0>
>>> PumpEvents(10)
>>>



During the PumpEvents phase I moved the device, and it should have registered a 
lot of events. But nothing happened.

This is with version 0.5.2 now. I did delete the gen folder when changing the 
version. But I didn't use the output from the first run here, because it was 
just way too long.
__________________________________________________________________________
Verschicken Sie SMS direkt vom Postfach aus - in alle deutschen und viele 
ausländische Netze zum gleichen Preis! 
https://produkte.web.de/webde_sms/sms




-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to