[python-win32] scheduler function weekdaytask

Tim Roberts timr at probo.com
Fri Apr 18 19:41:17 CEST 2008


kNish wrote:
> Hi,
>
> scheduler.py has a function weekdaytask. It needs five parameters as 
> stated in the scheduler.py. weekdays and timeonday I figured out.  
> what is name and action, args=None, kw=None ?

This is a TurboGears question, right?  As such, this is not really the 
right place to ask about it.  However, it's pretty easy to figure out 
what these are for, given the source code.

All four of those parameters are passed without change to the Task 
constructor, which simply stores them for future use.  You can see them 
being used in WeekdayTask.execute.  The "name" is not terribly 
important.  "action" is the function to be called when the task is 
executed.  "args" and "kw" are passed to the "action" function at that time.

"args" should be the list of positional parameters you need to pass to 
the "action" function (if any).  "kw" should be a dictionary of the 
keyword parameters you need to pass.  So, if you wanted to create a task 
to execute the following function:

    birthday( hwnd, name="kNish", year=2008 )

you would do something like this:
:
    wt = scheduler.WeekdayTask( "A birthday", xxx, xxx, birthday, 
(hwnd,), {"name": "kNish", "year": 2008 } )

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list