import wx
import os
class MainWindow(wx.Frame):
def __init__(self):
wx.Frame.__init__(self,None,-1,"Agent-Based Model of Residential Development", size = (640, 480))
self.panel = wx.Panel(self,-1)
self.imageFile = "C:/Documents and Settings/12345/My Documents/Files/Misc/everythingisshit.jpg" # provide a diff file name in same directory/path
self.bmp = wx.Image(self.imageFile,wx.BITMAP_TYPE_JPEG).ConvertToBitmap()
self.bmp.bitmap = wx.StaticBitmap(self.panel, -1, self.bmp)
#self.bmp.bitmap.GetSize()
#self.SetSize(self.bmp.bitmap.GetSize())
#self.Center()
button42 = wx.Button(self.panel, -1, "Read", pos=(540,50))
self.Bind(wx.EVT_BUTTON, self.OnRead ,button42)
def OnRead(self,event):
self.imageFile1="D:/Say cheese!/vanity/iuhf.jpg" # you have to provide a diff image file name
self.bmp = wx.Image(self.imageFile1,wx.BITMAP_TYPE_JPEG).ConvertToBitmap()
self.obj = wx.StaticBitmap(self.panel, -1, self.bmp)
#self.obj.GetSize()
#self.SetSize(self.obj.GetSize())
#self.Center()
self.obj.Refresh()
if __name__ == "__main__":
app = wx.PySimpleApp()
MainWindow().Show()
app.MainLoop()
Re-posted with code tags.
Karen,
Please make use of code tags when posting in this forum. In order to use them, you must simply wrap your code as such:
[code=python]
# Your code goes in here
[/code]
Oh also, try not to use curse words (as per forum rules), even if they are inadvertently placed in your code
Last edited by jlm699; Feb 26th, 2009 at 9:39 am.
Reputation Points: 355
Solved Threads: 292
Veteran Poster
Offline 1,102 posts
since Jul 2008