How to create a timer/scheduler in Python?

2008-07-12 Thread John Dann
I need what I'd call (in .Net) a timer, ie I need to run a function eg every 2 seconds - it doesn't need to be millisec accurate but it would be nice if it wasn't eg every 4 seconds or something. Rather surprisingly, Core Python (Chun) doesn't seem to index 'timer' or 'scheduler', which leaves me

Re: Scope and program structure problems

2008-07-01 Thread John Dann
Many thanks for the repsonse - much appreciated. And sorry - yes I was probably compounding two separate issues here - the GUI one and the variable scope one. Maybe the wxPython list would be the best place to ask more about the GUI side of things. Then actually I can simplify my remaining quest

Scope and program structure problems

2008-07-01 Thread John Dann
Trying to learn Python here, but getting tangled up with variable scope across functions, modules etc and associated problems. Can anyone advise please? Learning project is a GUI-based (wxPython) Python program that needs to access external data across a serial port. The first thing that I need

Komodo Edit newbie Q

2008-06-26 Thread John Dann
I'm learning Python using the Komodo Edit freeware code editor. One thing I'm finding a little confusing is that the code completion lists (what I would call Intellisense coming from a .Net background) are often very incomplete, especially with imported classes like wx. It's like KE can't look far

Re: Passing arguments to subclasses

2008-06-23 Thread John Dann
Thanks for the responses - they're much appreciated. And I understand the slight impatience with questions that could possibly be answered without recourse to a forum - I'm usually in the opposite position of fielding many newbie questions in a forum in a completely different field! But don't be t

Passing arguments to subclasses

2008-06-23 Thread John Dann
May I ask a simple newbie question, which I presume is true, but for which I can't readily find confirmation: Let's say I have a parent class with an __init__ method explicitly defined: class ParentClass(object): def __init__(self, keyword1, keyword2): etc and I subclass

Re: Simple Python class questions

2008-06-20 Thread John Dann
Many thanks for the further comments: On Thu, 19 Jun 2008 21:24:31 -0400, Terry Reedy <[EMAIL PROTECTED]> wrote: >> def __init__(self): >> Try >> Import serial # the pyserial library >The import should be at module level. You only want to do it once, not

Re: Simple Python class questions

2008-06-19 Thread John Dann
Many thanks for the speedy replies. On Thu, 19 Jun 2008 14:14:02 +0200, Cédric Lucantis <[EMAIL PROTECTED]> wrote: >Le Thursday 19 June 2008 13:54:03 John Dann, vous avez écrit : >> Let's say I define the class in a module called comms.py. The class >> isn't r

Simple Python class questions

2008-06-19 Thread John Dann
A Python newbie, but some basic understanding of how classes, objects etc work in eg VB.Net. However, I'm struggling a little to translate this knowledge into the Python context. I'm trying to teach myself this aspect of Python by working up a trial project, part of which calls for pulling in data

Re: Numeric type conversions

2008-06-17 Thread John Dann
On Tue, 17 Jun 2008 08:58:11 -0700 (PDT), MRAB <[EMAIL PROTECTED]> wrote: >[snip] >Please note that in slicing the start position is included and the end >position is excluded, so that should be ByteStream[12:14]. Yes, I just tripped over that, in fact, hence the error in my original post. I supp

Numeric type conversions

2008-06-17 Thread John Dann
I'm new to Python and can't readily find the appropriate function for the following situation: I'm reading in a byte stream from a serial port (which I've got working OK with pyserial) and which contains numeric data in a packed binary format. Much of the data content occurs as integers encoded as