Problem reloading the image on the frame

Is there any way to repaint the area where we are loading a new image… because in my application it is getting loaded on each other… I have changed the code of rotate function of my program…it is working fine but it is putting image on each other and not refreshing the view…

def OnRotate(self,event):
im1 = Image.open(self.pict)
im11=im1.rotate(deg)
ext = “.jpg”
im11.save(“./pics/rotate” + ext)
i = wx.Image(‘./pics/rotate.jpg’, wx.BITMAP_TYPE_JPEG).ConvertToBitmap()
self.obj.SetBitmap(i)
self.obj.Refresh()

this is the part of the function rotate which i have changed… but it seems the refresh function is not appropriate here… i want to clear the old image and then put the new image…i donno how to refresh or repaint the surface…

···

On Feb 8, 2008 3:11 PM, Varsha Purohit varsha.purohit@gmail.com wrote:

Yeahh i am trying to figure out how to communicate like that in wxpython. since i am new to wxpython i am not able to understand how to do it… can u please explain me with respect ot my code ???

On Feb 8, 2008 2:12 PM, Robin Dunn robin@alldunn.com wrote:

Varsha Purohit wrote:

Hell All,
I had mailed last time regarding some problem of event handling. i
decided to create this program using menubar. I have attached a sample

program where i am creating a menubar, toolbar. I have 3 options in tool
bar which are zoomin, zoomout and rotate. i am using PIL image functions
to implement rotation as of now. Image is getting rotated by 90degrees

and it is getting saved in the local folder and i am reading the same
image and trying to load it on the frame but suprisingly it is not
working out. Can you please have a look on the code and tell me what is

the problem. I have used icons in the tool bar so you have to save 3icon
files (.png) any arbitrary is fine, in the local folder.

i m having trouble with onRotate button handler which works fine but it

is not able to reload the saved image on the frame…

def OnRotate(self,event):
    im1 = Image.open(self.pict)
    im11=im1.rotate(90)
    ext = ".jpg"
    im11.save("rotate" + ext)

    try:
        self.control = wx.ScrolledWindow(self,-1)
        self.bmp =

wx.Image(‘rotate.jpg’,wx.BITMAP_TYPE_JPEG).ConvertToBitmap()

        wx.StaticBitmap(self.control, -1, self.bmp)
    except:
        print "exception"
        self.Close()

Instead of creating a new set of scrolled window and static bitmap

widgets, you should just tell the existing ones to display the new data.


Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!


To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org

For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Varsha Purohit,
Graduate Student


Varsha Purohit,
Graduate Student