OCX and Events - ietimer.ocx

A place for windows-specific questions.

Moderators: KDoiron, ChrJim, mawe, python

OCX and Events - ietimer.ocx

Postby yohannbzh on Tue Mar 09, 2010 10:12 am

Hello,

I'm trying to work with OCX files in Python script (you can see it in my last topic "Use an OCX", my problem is always here).
I have downloaded ietimer.ocx because i want to test the events in OCX.
Here is my code :

Code: Select all
from win32com.client import DispatchWithEvents
i = 0

class Events:
    def OnTimer(self):
        global i
        i = i + 1

l = DispatchWithEvents("Internet.Timer.1", Events)
l.Interval = 1000
l.Enabled = True
print "Press any key when finished with Timer!"
# Wait for a keypress

import time, pythoncom, msvcrt
while not msvcrt.kbhit():
    pythoncom.PumpWaitingMessages()
    time.sleep(.2)
# Gobble the key.
msvcrt.getch()
print i
# Release the object
l = None


I was expecting that my function OnTimer would be called every second (1000ms) but it is not the case (I tried with Interval = 1 but it is the same).
Can someone explain me why?
Thanks

Yohann
yohannbzh
Python Fan
Python Fan
 
Posts: 5
Joined: Mon Mar 08, 2010 9:37 am

Re: OCX and Events - ietimer.ocx

Postby waz on Tue Mar 09, 2010 11:55 am

yohannbzh wrote:I was expecting that my function OnTimer would be called every second (1000ms) but it is not the case (I tried with Interval = 1 but it is the same).


So... what is the case, then? What's happening instead?
҉ 囧 ҉
waz
Ultimate Python Hacker
Ultimate Python Hacker
 
Posts: 1348
Joined: Tue May 05, 2009 7:02 pm

Re: OCX and Events - ietimer.ocx

Postby yohannbzh on Tue Mar 09, 2010 3:47 pm

It does nothing.
My callback OnTimer is never called.
yohannbzh
Python Fan
Python Fan
 
Posts: 5
Joined: Mon Mar 08, 2010 9:37 am


Return to Python on Windows

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests

Sponsored by Dreamlink Web hosting and Traduzioni Rumeno Italiano and ASSP Deluxe for cPanel.