Rendering/displaying an image in/on a wx.Frame

Know there’s some sample code in wx demo’s, etc., but, OTOH, what’s the simplest/easiest way to just render an image in something like a wx.Frame, preferably with frame sizing to fit around it/match it’s dimensions?

Doesn’t really need to be in among any other controls, besides maybe offering something like a button to close the popup, or something, but, would just like to be able to easily let someone do something like click on a button, and have it then do something like popup a modal dialogue with a picture rendering on it?

And, just in case image dimensions are larger than current screen resolution, presume the wx.lib.scrolledpanel would then also allow the user to then scroll around the image view - or else, would it sort of automatically resize itself to fit inside some or other image rendering control?

And, yes, could look for source code across the 'net, but, since this is also something I can’t really test drive myself, besides checking for code errors, etc., thought may as well ask here?

TIA

Jacob Kruger
Blind Biker
Skype: BlindZA
“Roger Wilco wants to welcome you…to the space janitor’s closet…”

Ok, think got hold of simple/basic code that seems to work - sorry about tab character indentation:

#start code

import wx, os

class Frame(wx.Frame):
def init(self, parent, id, title, img_path):
wx.Frame.init(self, parent, id, title, style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER)

image = wx.StaticBitmap(self, wx.ID_ANY)
png = wx.Image(img_path, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
image.SetBitmap(wx.Bitmap(img_path))

sizer = wx.BoxSizer()
sizer.Add(image)
self.SetSizerAndFit(sizer)

self.Show(True)
if name == “main”:
app = wx.App()
frame = Frame(None, wx.ID_ANY, ‘Image’, os.path.realpath(“darth01.png”))
app.MainLoop()
#end code

Jacob Kruger
Blind Biker
Skype: BlindZA
“Roger Wilco wants to welcome you…to the space janitor’s closet…”

···

----- Original Message -----

From:
Jacob Kruger

To: wxpython-users@googlegroups.com

Sent: Wednesday, December 24, 2014 1:16 PM

Subject: [wxPython-users] Rendering/displaying an image in/on a wx.Frame

Know there’s some sample code in wx demo’s, etc., but, OTOH, what’s the simplest/easiest way to just render an image in something like a wx.Frame, preferably with frame sizing to fit around it/match it’s dimensions?

Doesn’t really need to be in among any other controls, besides maybe offering something like a button to close the popup, or something, but, would just like to be able to easily let someone do something like click on a button, and have it then do something like popup a modal dialogue with a picture rendering on it?

And, just in case image dimensions are larger than current screen resolution, presume the wx.lib.scrolledpanel would then also allow the user to then scroll around the image view - or else, would it sort of automatically resize itself to fit inside some or other image rendering control?

And, yes, could look for source code across the 'net, but, since this is also something I can’t really test drive myself, besides checking for code errors, etc., thought may as well ask here?

TIA

Jacob Kruger
Blind Biker
Skype: BlindZA
“Roger Wilco wants to welcome you…to the space janitor’s closet…”


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.