#!/usr/bin/env python
import wx
class Frame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title="Title")
panel = wx.Panel(self)
box = wx.BoxSizer(wx.VERTICAL)
button = wx.Button(panel, wx.ID_ANY, "Load image")
button.Bind(wx.EVT_BUTTON, self.ChangeImage)
box.Add(button, 0, wx.ALL, 10)
self.image = wx.StaticBitmap(panel)
box.Add(self.image, 0, wx.ALL, 10)
panel.SetSizer(box)
panel.Layout()
def ChangeImage(self, event):
wx.CallAfter(self.image.SetBitmap, wx.Bitmap(wx.Image("usingBitmaps.png", wx.BITMAP_TYPE_ANY).Rescale(150, 150)))
if __name__ == "__main__":
app = wx.App()
top = Frame()
top.Show()
app.MainLoop()