Column not updating in listbox in wxPython example ??

2005-11-18 Thread David Poundall
In the following example the phone number does not apear in the phone column of the llistbox. Can anybody tell me what I am doing wrong here ? from wxPython.wx import * class MyApp (wxApp) : def OnInit (self) : frame = MyFrame(NULL, -1, "Phone List") frame.Show(true) self.Se

Re: Stretching a bitmap

2005-11-17 Thread David Poundall
I need to be able to do this on the fly within a WX frame. I think I have found it though. There is a resize function in the image class in the _core code of wxPython. All I have to do now is learn how to access the bugger. Syntax anyone ?? -- http://mail.python.org/mailman/listinfo/python-li

Stretching a bitmap

2005-11-17 Thread David Poundall
Is it possible to import a bitmap and stretch it to fit a defined area with wxPython? If so, could someone point me to any relevent web reference on the subject? Thanks in advance David -- http://mail.python.org/mailman/listinfo/python-list

Re: dreaming in Python

2005-10-30 Thread David Poundall
Sounds like someone may have the kernal of an idea for a book here ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Counting Threads

2005-10-29 Thread David Poundall
After much optimisation it turns out the following code does the job for me. In the end using count didn't give me the flexibility I needed. Instead I now name each thread and track them accordingly. It's arguable if I need the thread locking now though, however I have left it in to remind me of

Re: Counting Threads

2005-10-28 Thread David Poundall
Sorry Denis - but could you give me an example. I can't for the life of me see how the syntax for that would go. -- http://mail.python.org/mailman/listinfo/python-list

Re: Counting Threads

2005-10-27 Thread David Poundall
First time I have used thread locking. This seems to work but is it correct? from threading import Thread, Event, Lock . . . def launch(self, ThreadTitle, SubToLaunch, SubsArgs=(), SubsKwargs={}, AsDaemon=True): my_lock = Lock() my_lock.acquire() try: # ---

Re: Counting Threads

2005-10-27 Thread David Poundall
>> But the count isn't doint what I expected. I was after a increment >> after every time the class was used ireespective of instance. >I have no idea what that last sentence above means... On re-reading it - neither do I. Sorry about that. What I meant to say was that I was after an incremen

Re: Counting Threads

2005-10-27 Thread David Poundall
Just sorted (its always the way when you post isn't it) But the count isn't doint what I expected. I was after a increment after every time the class was used ireespective of instance. Instead I get a count based on the instance usage. Idea's anyone? # -

Re: Counting Threads

2005-10-27 Thread David Poundall
Just sorted (its always the way when you post isn't it) But the count isn't doint what I expected. I was after a increment after every time the class was used ireespective of instance. Instead I get a count based on the instance usage. Idea's anyone? # -

Counting Threads

2005-10-27 Thread David Poundall
I have a thread class and I want to be able to track its usage within an application. FYI the class launches aplications in their own thread when the 'launch' method is called. That works OK However I want to take things a bit further and my thinking was that I could use a class parameter to do

Re: How best to reference parameters.

2005-10-26 Thread David Poundall
Sorry Ron, my earlier reply was too brief I wasn't thinking straight (so what else is new ;-) my apologies. The main reason for going down the route I am looking at (thread 2) is that intellisense runs OK in my IDE using that aproach. In my application this will be important as I will be using t

Re: How best to reference parameters.

2005-10-26 Thread David Poundall
Sadly Ron, c_y can only see index and showall in your example. -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I access the property info in this example ?

2005-10-26 Thread David Poundall
Thanks - I was trying to do c = C() print c.x.__doc__ my mistake. -- http://mail.python.org/mailman/listinfo/python-list

How do I access the property info in this example ?

2005-10-26 Thread David Poundall
How do I access the property information in this example ? class C(object): def getx(self): return self.__x def setx(self, value): self.__x = value def delx(self): del self.__x x = property(getx, setx, delx, "I'm the 'x' property.") I would like to get at ... "I'm the 'x' propert

Re: How best to reference parameters.

2005-10-26 Thread David Poundall
Nice - I like that Tony. I had seen it around before but I didn't catch on. Thanks for the clear example.. -- http://mail.python.org/mailman/listinfo/python-list

Re: How best to reference parameters.

2005-10-25 Thread David Poundall
It looks like I am going to have to bite the bullet and use properties. The following should do what I want. class test: def __init__(self): self.__HB = 0 self.__VPG = 0 def _get_HB(self): return (self.__HB, 'MF1', 0) def _set_HB(self, x): self.__HB = x HB = prope

How best to reference parameters.

2005-10-25 Thread David Poundall
I am writing a scada package that has a significant amount of user defined parameters stored in text files that I wish to cleanly access in code. By way of an example, a few lines from the configuration file would typically be ... [Plant Outputs] Y0 P1 Pump 1 Pressure Y1 P2 Pu

Re: Tricky import question.

2005-10-25 Thread David Poundall
repr() is a new one on me I am afraid, and I have yet to achieve any decent competance with global and local lists. As you probaly noticed earlier, I managed to bungle my way through this time. However, I will log this thread away for when I next get stuck with a bindings. Thank you Bengt :-)

Re: Tricky import question.

2005-10-25 Thread David Poundall
All I was trying to do with my feeble code attempt, was to return a reference to the imported module so that I could do... result = instanceref.main() where main was a function within the import. Having glanced at the code in the import section of the help files all morning, when I actually sat

Re: Tricky import question.

2005-10-25 Thread David Poundall
This worked ... def my_import(name): mod = __import__(name) components = name.split('.') for comp in components[1:]: mod = getattr(mod, comp) return mod for reasons given here... http://www.python.org/doc/2.3.5/lib/built-in-funcs.html -- http://mail.python.org/mailman/l

Re: Tricky import question.

2005-10-25 Thread David Poundall
Sadly I get this reply when I try that. AttributeError: 'module' object has no attribute 'main' I am getting the impression that the value returned from the __import__() function is only a string reference NOT an object. I am going to have a go at trying this with the imp' module as that specifi

Tricky import question.

2005-10-25 Thread David Poundall
importedfiles = {} for f in FileList f2 = f.split('.')[0] # strip the .py, .pyc __import__(f2) s2 = f2+'.main()' # main is the top file in each import c = compile(s2, '', 'eval') importedfiles[f2] = eval(c) 'importedfiles' should hold an object reference to the main() fun

Re: Importing at runtime

2005-10-24 Thread David Poundall
> Imports happen at run time. Beware starting threads in the code run at > import time in each module, though - there are some nasty bugs lurking > there. Instead, start the threads in functions invoked from the main > routine. I have run into trouble trying to do that before. Thanks for the remi

Re: Importing at runtime

2005-10-24 Thread David Poundall
Devan, would ... __import__(name) for name in module_names have worked just as well - without the equate to modules? or is the modules list required as a hook for the imports ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Importing at runtime

2005-10-24 Thread David Poundall
Thanks James, just after I posted I stumbled across the execfile command. Looks like with 'exec' and 'execfile' I should be able to do what I want. What an elegant language. -- http://mail.python.org/mailman/listinfo/python-list

Importing at runtime

2005-10-24 Thread David Poundall
I have several .py files in a directory that I would like to import at run time. Each file contains a state machine that requires to be run in its own thread. The first problem I have is how can I import the code in all of the .py files without knowing the file names in advance. Can this be done