pluto mars
2014-10-16 18:25:40 UTC
Hi,
I want to display an image such that it fits exactly on a wxpanel. For this
I set the size of the wxpanel to the size of the image I want to display.
However I see that the panel is slightly smaller than my image. Anyone
knows how to solve this ?
regards,
Pluto
import wx
import os
class Panel(wx.Panel):
def __init__(self, parent, path):
bitmap = wx.Bitmap(path)
orgWidth = bitmap.GetWidth()
orgHeight = bitmap.GetHeight()
panelWidth = orgWidth
panelHeight = orgHeight
wx.Panel.__init__(self, parent,-1, size=(panelWidth, panelHeight))
self.ImgControl = wx.StaticBitmap(self, -1, bitmap)
self.ImgControl.Center( )
if __name__ == '__main__':
app = wx.PySimpleApp()
frame = wx.Frame(None, -1, 'Scaled Image', size=(1392, 1040))
panel = Panel(frame, os.path.join( os.getcwd(), "middleWhite.tif") )
frame.Show()
app.MainLoop()
I want to display an image such that it fits exactly on a wxpanel. For this
I set the size of the wxpanel to the size of the image I want to display.
However I see that the panel is slightly smaller than my image. Anyone
knows how to solve this ?
regards,
Pluto
import wx
import os
class Panel(wx.Panel):
def __init__(self, parent, path):
bitmap = wx.Bitmap(path)
orgWidth = bitmap.GetWidth()
orgHeight = bitmap.GetHeight()
panelWidth = orgWidth
panelHeight = orgHeight
wx.Panel.__init__(self, parent,-1, size=(panelWidth, panelHeight))
self.ImgControl = wx.StaticBitmap(self, -1, bitmap)
self.ImgControl.Center( )
if __name__ == '__main__':
app = wx.PySimpleApp()
frame = wx.Frame(None, -1, 'Scaled Image', size=(1392, 1040))
panel = Panel(frame, os.path.join( os.getcwd(), "middleWhite.tif") )
frame.Show()
app.MainLoop()
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.