Re: Newbie wxpython staticbitmap help please

2006-06-16 Thread jean-michel bain-cornu
Hi,
janama a écrit :
 jean-michel bain-cornu wrote:
 Why won't you write it yourself using the demo ?
 It's clear and well documented.
 Regards,
 jm
 
 Hi, have been just trying for 5 hours with the timer demo in wx, i just
 havnt clicked with how to tie it in together,
 
 I know (think) i need the following features from the timer demo ,
 where you can periodically call a function using the wx.timer
 
 self.Bind(wx.EVT_TIMER, self.OnTest1Timer)
 #---(bind to the frame ?)
Bind to any method
 
 self.Bind(wx.EVT_BUTTON, self.OnTest3Start, t3b1)
 #---(this binds to a button, how do i bind to my application on load or
 startup instead ?)
???
 
 def OnTest1Timer(self, evt):
 self.log.write(got EVT_TIMER event\n)
 #---(dont think i need the logging?)
You don't need of course, it's just for demo information.
 
 def OnTest3Start(self, evt):
 self.t3 = NotifyTimer(self.log)
 self.t3.Start(1000)
 self.log.write(NotifyTimer timer started\n)
 self.t3b2.Enable()
 
 #---(the Start i guess i will work if i remap the button event to an on
 load type? event?
 
 def OnTest3Stop(self, evt):
 self.t3.Stop()
 self.log.write(NotifyTimer timer stoped\n)
 del self.t3
 self.t3b2.Disable()
 #---(Guess i wont need to stop the timer, as i want it to trigger the
 'refreshing' of the StaticBitmaps ?)
 
 # When deriving from wx.Timer you must provide a Notify method
 # that will be called when the timer expires.
 class NotifyTimer(wx.Timer):
 def __init__(self, log):
 wx.Timer.__init__(self)
 self.log = log
 
 def Notify(self):
 self.log.write(got NotifyTimer event\n)
 #---(dont know if i need this if i dont want to use this log feature)?
 
 
  Im sorry if this all seems really amatuerish, i have genuially tried
 hard to get my head around it , but i get error after error in boa.
Boa is well done for editing, simple objects generation, also for 
learning, but not for complex operation. It's not a good idea to use it 
for your present need.
 Somewhone couldnt append a timer and perhaps help to refresh the
 StaticBitmaps described, with the code, in first post). I will be able
 to see and learn greatly from this.
 
 Maybe some advice on where to find lists of the methods used in
 wxpython
 For example it took me hours to find methods ? like
In the help file, there is an alphabetic classes list, with (quite) all 
the methods.
 
 StaticBitmap.SetImage(imageName)
 
 Is there any good lists of these methods, properties etc for wxpython
 controls?
See before. This is the best, and also the demo (and also the sources).
 
 Any good wxpython ide/editors that can intellisense them?  boa,
 komodo, stani's arnt working with intellisensing wx for me, (maybe i
 cant configure them though)
The best is probably boa, because it have got a debugger, with a 
separate process launched for testing.
 
 Thanks for any help with any of this
 
 Regards
 
All what you have to do is :
 def __init__(self, parent):
 self._init_ctrls(parent)
 self.t1 = wx.Timer(self)
 self.t1.Start(2000) # 2 seconds
 self.Bind(wx.EVT_TIMER, self.OnTest1Timer)

 def OnTest1Timer(self, evt):
 if os.path.isfile('App1.py'):
 i = wx.Image('image.jpg',wx.BITMAP_TYPE_JPEG)
 b1 = wx.BitmapFromImage(i)
 self.staticBitmap1.SetBitmap(b1)
And you can continue to use Boa as usual.
Hope you'll enjoy,
jm
Ps: tested on xp, pretty sure it works also on linux.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie wxpython staticbitmap help please

2006-06-16 Thread janama
Thanks Jean this now makes sense, really appreciate your time and
effort mate.

def __init__(self, parent):
self._init_ctrls(parent)
self.t1 = wx.Timer(self)
self.t1.Start(2000) # 2 seconds
self.Bind(wx.EVT_TIMER, self.OnTest1Timer)

self.OnTest1Timer(self)

def OnTest1Timer(self, evt):

if os.path.isfile('images/page1.txt'):
  print ok file present
  i = wx.Image('images/pageGreen.png',wx.BITMAP_TYPE_PNG)
  b1 = wx.BitmapFromImage(i)
  self.staticBitmap1.SetBitmap(b1)
else:
  print ok file present
  i = wx.Image('images/pageGrey.png',wx.BITMAP_TYPE_PNG)
  b1 = wx.BitmapFromImage(i)
  self.staticBitmap1.SetBitmap(b1)

The above works a treat,

thanks again Jean

janama

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie wxpython staticbitmap help please

2006-06-15 Thread jean-michel bain-cornu
janama a écrit :
   Can somewhone add a wx.Timer example to this to make it check
 if the file exists every minute or so , instead of clicking the button
 to check and update this? Or is there a better way of auto updating my
 little gui apps StaticBitmap if a file exists?
Why won't you write it yourself using the demo ?
It's clear and well documented.
Regards,
jm
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie wxpython staticbitmap help please

2006-06-15 Thread janama

jean-michel bain-cornu wrote:
 Why won't you write it yourself using the demo ?
 It's clear and well documented.
 Regards,
 jm

Hi, have been just trying for 5 hours with the timer demo in wx, i just
havnt clicked with how to tie it in together,

I know (think) i need the following features from the timer demo ,
where you can periodically call a function using the wx.timer

self.Bind(wx.EVT_TIMER, self.OnTest1Timer)
#---(bind to the frame ?)

self.Bind(wx.EVT_BUTTON, self.OnTest3Start, t3b1)
#---(this binds to a button, how do i bind to my application on load or
startup instead ?)

def OnTest1Timer(self, evt):
self.log.write(got EVT_TIMER event\n)
#---(dont think i need the logging?)

def OnTest3Start(self, evt):
self.t3 = NotifyTimer(self.log)
self.t3.Start(1000)
self.log.write(NotifyTimer timer started\n)
self.t3b2.Enable()

#---(the Start i guess i will work if i remap the button event to an on
load type? event?

def OnTest3Stop(self, evt):
self.t3.Stop()
self.log.write(NotifyTimer timer stoped\n)
del self.t3
self.t3b2.Disable()
#---(Guess i wont need to stop the timer, as i want it to trigger the
'refreshing' of the StaticBitmaps ?)

# When deriving from wx.Timer you must provide a Notify method
# that will be called when the timer expires.
class NotifyTimer(wx.Timer):
def __init__(self, log):
wx.Timer.__init__(self)
self.log = log

def Notify(self):
self.log.write(got NotifyTimer event\n)
#---(dont know if i need this if i dont want to use this log feature)?


 Im sorry if this all seems really amatuerish, i have genuially tried
hard to get my head around it , but i get error after error in boa.
Somewhone couldnt append a timer and perhaps help to refresh the
StaticBitmaps described, with the code, in first post). I will be able
to see and learn greatly from this.

Maybe some advice on where to find lists of the methods used in
wxpython
For example it took me hours to find methods ? like

StaticBitmap.SetImage(imageName)

Is there any good lists of these methods, properties etc for wxpython
controls?

Any good wxpython ide/editors that can intellisense them?  boa,
komodo, stani's arnt working with intellisensing wx for me, (maybe i
cant configure them though)

Thanks for any help with any of this

Regards

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie wxpython staticbitmap help please

2006-06-15 Thread jean-michel bain-cornu
 Thanks for any help with any of this
I have no time at the moment.
I'm going to try to give you an answer tomorrow morning (june 16) (if 
nobody did of course).
See you
jm
-- 
http://mail.python.org/mailman/listinfo/python-list