Hi, how do i go about having my little gui (boa) app updating (changing) the bitmap used in a StaticBitmap automatically. In the example below when i click the button the app check checks to see if a file exists and if so it swaps the StaticBitmap in the gui to another bitmap. 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?
Thanks for any help with this Regards ################################################ Frame1 # Frame 1 #Boa:Frame:Frame1 import wx import os def create(parent): return Frame1(parent) [wxID_FRAME1, wxID_FRAME1BUTTON1, wxID_FRAME1PANEL1, wxID_FRAME1STATICBITMAP1, ] = [wx.NewId() for _init_ctrls in range(4)] class Frame1(wx.Frame): def _init_ctrls(self, prnt): # generated method, don't edit wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt, pos=wx.Point(535, 346), size=wx.Size(175, 109), style=wx.DEFAULT_FRAME_STYLE, title='Frame1') self.SetClientSize(wx.Size(167, 75)) self.panel1 = wx.Panel(id=wxID_FRAME1PANEL1, name='panel1', parent=self, pos=wx.Point(0, 0), size=wx.Size(167, 75), style=wx.TAB_TRAVERSAL) self.staticBitmap1 = wx.StaticBitmap(bitmap=wx.Bitmap('Z:/Dan/scripting/python/gui/up1.png', wx.BITMAP_TYPE_PNG), id=wxID_FRAME1STATICBITMAP1, name='staticBitmap1', parent=self.panel1, pos=wx.Point(16, 24), size=wx.Size(32, 32), style=0) self.button1 = wx.Button(id=wxID_FRAME1BUTTON1, label='button1', name='button1', parent=self.panel1, pos=wx.Point(64, 24), size=wx.Size(88, 32), style=0) self.button1.Bind(wx.EVT_BUTTON, self.OnButton1Button, id=wxID_FRAME1BUTTON1) def __init__(self, parent): self._init_ctrls(parent) def OnButton1Button(self, event): if os.path.isfile('Z:/Dan/scripting/python/gui/p1.txt'): i = wx.Image('Z:/Dan/scripting/python/gui/up2.png', wx.BITMAP_TYPE_PNG) b1 = wx.BitmapFromImage(i) self.staticBitmap1.SetBitmap(b1) event.Skip() ################################################ App1 #!/usr/bin/env python #Boa:App:BoaApp import wx import Frame1 modules ={'Frame1': [1, 'Main frame of Application', 'Frame1.py']} class BoaApp(wx.App): def OnInit(self): wx.InitAllImageHandlers() self.main = Frame1.create(None) self.main.Show() self.SetTopWindow(self.main) return True def main(): application = BoaApp(0) application.MainLoop() if __name__ == '__main__': main() -- http://mail.python.org/mailman/listinfo/python-list