Having a picture scale with a window?

Hi
first post here as im new to wxpython (and python)
im trying to show an image in a window and have it scale with the
window as i resize it.
i get the image to scale as i want the first time its drawn (500x500)
but then i cant figure out how to update the size of the image as the
window resizes?

this is as far as i have gotten:
http://pastie.org/478104

cheers
Gustaf

···

--
■ ■ ■ ■ ■ ■ ■ ■ ■ ■

Gustaf,

Gustaf Nilsson wrote:

Hi
first post here as im new to wxpython (and python)
im trying to show an image in a window and have it scale with the
window as i resize it.
i get the image to scale as i want the first time its drawn (500x500)
but then i cant figure out how to update the size of the image as the
window resizes?

this is as far as i have gotten:
http://pastie.org/478104
  

Have you tried using SetBitmap instead of creating a new self.ola control in OnSize?

e.g.:
self.ola.SetBitmap(newlyscaled image)

It would probably also help if you use sizers, they are a bit tough to get ones head around to start with but they are really great.

Werner

···

cheers
Gustaf

yay it worked!
thanks!

···

2009/5/15 Werner F. Bruhin <werner.bruhin@free.fr>:

Gustaf,

Gustaf Nilsson wrote:

Hi
first post here as im new to wxpython (and python)
im trying to show an image in a window and have it scale with the
window as i resize it.
i get the image to scale as i want the first time its drawn (500x500)
but then i cant figure out how to update the size of the image as the
window resizes?

this is as far as i have gotten:
http://pastie.org/478104

Have you tried using SetBitmap instead of creating a new self.ola control in
OnSize?

e.g.:
self.ola.SetBitmap(newlyscaled image)

It would probably also help if you use sizers, they are a bit tough to get
ones head around to start with but they are really great.

Werner

cheers
Gustaf

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

--
■ ■ ■ ■ ■ ■ ■ ■ ■ ■

You may also try using my module:
http://dev.vladiuz.com/trac/wiki/imView

Its undocumented yet, but you can checkout the demo, there is a ZoomToFit()
function you can use on resize.

I will make a demo just for you when I got time.

Vladiuz

···

-----Original Message-----
From: wxpython-users-bounces@lists.wxwidgets.org
[mailto:wxpython-users-bounces@lists.wxwidgets.org] On Behalf Of Gustaf
Nilsson
Sent: Friday, May 15, 2009 12:49 PM
To: wxpython-users@lists.wxwidgets.org
Subject: Re: [wxpython-users] Having a picture scale with a window?

yay it worked!
thanks!

2009/5/15 Werner F. Bruhin <werner.bruhin@free.fr>:

Gustaf,

Gustaf Nilsson wrote:

Hi
first post here as im new to wxpython (and python)
im trying to show an image in a window and have it scale with the
window as i resize it.
i get the image to scale as i want the first time its drawn (500x500)
but then i cant figure out how to update the size of the image as the
window resizes?

this is as far as i have gotten:
http://pastie.org/478104

Have you tried using SetBitmap instead of creating a new self.ola control

in

OnSize?

e.g.:
self.ola.SetBitmap(newlyscaled image)

It would probably also help if you use sizers, they are a bit tough to get
ones head around to start with but they are really great.

Werner

cheers
Gustaf

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

--
│ │ │ │ │ │ │ │ │ │
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users