This problem is getting solved if i use the Refresh function in the button
handler. But I have a function where i am generating Jpeg images dynamically
in a separate script. And i need to load these images on GUI as soon as they
start generating. They have common names like xyz1.jpeg and xyz2.jpeg. And i
need to start loading images one after another on the gui panel when they
are created. these images are created one after another with a particular
time delay(not constant). So i have to check when they are created, and i
should load them on gui. So how should i communicate to the gui that image
has been created and it should load the image ?


On Dec 2, 2007 4:29 PM, Varsha Purohit <[EMAIL PROTECTED]> wrote:

> hello everyone,
>         i made a small applicatin where i need to display an image on a
> panel. and then when i press the read button it should read another image
> and display it on the same panel. Its working but i have to press the read
> button two times then only its working....
>
> import wx
> import os
>
> APP_SIZE_X = 700
> APP_SIZE_Y = 300
>
>
> class MainWindow(wx.Frame):
>     def __init__(self):
>         wx.Frame.__init__(self,None,-1,"Agent-Based Model of Residential
> Development", size = (APP_SIZE_X, APP_SIZE_Y))
>
>         self.panel = wx.Panel(self,-1)
>         self.imageFile = "r10001t0.asc.jpg"  # provide a diff file name in
> same directory/path
>         self.bmp = 
> wx.Image(self.imageFile,wx.BITMAP_TYPE_JPEG).ConvertToBitmap()
>         wx.StaticBitmap(self.panel, -1, self.bmp, (20,20), (80,120))
>
>         button42 = wx.Button(self.panel, -1, "Read", pos=(240,20))
>         self.Bind(wx.EVT_BUTTON, self.OnRead ,button42)
>
>     def OnRead(self,event):
>         self.imageFile1="DSCN3378.jpg" # you have to provide a diff image
> file name
>         self.bmp = 
> wx.Image(self.imageFile1,wx.BITMAP_TYPE_JPEG).ConvertToBitmap()
>
>         self.obj = wx.StaticBitmap(self.panel, -1, self.bmp, (20,20),
> (80,120))
>         self.obj.Refresh()
>
> app = wx.PySimpleApp()
> MainWindow().Show()
> app.MainLoop()
>
> Load two different jpeg images.
> --
> Varsha
>
>


-- 
Varsha Purohit,
Graduate Student
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to