Thanks all for your contributions.
Just for future reference, if someone with similar query found this thread… Here is the solution provided by Rolf of Saxony:-
import wx
class MyFrame2 ( wx.Frame ):
def __init__( self, parent ):
wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( 500,300 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )
self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
bSizer11 = wx.BoxSizer( wx.HORIZONTAL )
self.img1=wx.Image("1.bmp", wx.BITMAP_TYPE_ANY)
self.img2=wx.Image("1.bmp", wx.BITMAP_TYPE_ANY)
self.m_bitmap3 = wx.StaticBitmap( self, wx.ID_ANY, wx.BitmapFromImage(self.img1), wx.DefaultPosition, wx.DefaultSize, 0 )
bSizer11.Add( self.m_bitmap3, 1, wx.EXPAND, 0 )
self.m_bitmap4 = wx.StaticBitmap( self, wx.ID_ANY, wx.BitmapFromImage(self.img2))
bSizer11.Add( self.m_bitmap4, 1, wx.EXPAND, 0 )
self.Bind(wx.EVT_SIZE, self.onResize)
self.SetSizer( bSizer11 )
self.Layout()
self.Centre(wx.BOTH)
def __del__( self ):
pass
def onResize(self, event):
# self.Layout()
frame_size = self.GetSize()
frame_h = (frame_size[0]-10) / 2
frame_w = (frame_size[1]-10) / 2
img1 = self.img1.Scale(frame_h,frame_w)
img2 = self.img2.Scale(frame_h,frame_w)
self.m_bitmap3.SetBitmap(wx.BitmapFromImage(img1))
self.m_bitmap4.SetBitmap(wx.BitmapFromImage(img2))
self.Refresh()
self.Layout()
app = wx.App(0)
MyFrame2(None).Show()
app.MainLoop()
···
On Sun, Sep 24, 2017 at 6:27 AM, Tim Roberts timr@probo.com wrote:
On Sep 23, 2017, at 4:57 AM, Umar Yusuf bintacomputers@gmail.com wrote:
Am still struggling with this, my latest effort is: https://pastebin.com/JN6qwbQr
Well, you’re not really “struggling”, because you’ve only written a few lines of code. I hope you’re not expecting us to write all of this for you; we’ve given you text hint and a link to a sample It’s up to you to do the research.
Here are some points to remember. You are not seeing the difference between the bitmap control and the image that the control holds. When you say self.m_bitmap3.GetSize(), you are getting the size of the control’s window, not the size of the image.
When you get the EVT_SIZE call, you are being told that the control’s window changed size. When you get that notice, YOU need to resize the bitmap, and then send that resized bitmap to the control. That means you’ll need to keep a copy of the original image in your data so you can resize it.
—
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
–
You received this message because you are subscribed to the Google Groups “wxPython-users” group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
–
*Wouldn’t you rather do Business with us? *
This message is for the designated recipient only and may contain
privileged, proprietary, or otherwise private information. If you have
received it in error, please notify the sender immediately and delete the
original. Any use of the email by you is prohibited. If you have received
this communication in error, please notify the author by replying to this
e-mail immediately.
www.BintaSMS.com <http://www.bintasms.com/>
www.BintaComputers.net <http://www.bintacomputers.net/>