[GRASS-SVN] r47054 - grass-addons/grass7/gui/wxpython/wx.wms
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jul 7 20:24:13 EDT 2011
Author: sudeepsingh
Date: 2011-07-07 17:24:13 -0700 (Thu, 07 Jul 2011)
New Revision: 47054
Added:
grass-addons/grass7/gui/wxpython/wx.wms/image.py
Log:
class to handle displaying of images
Added: grass-addons/grass7/gui/wxpython/wx.wms/image.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.wms/image.py (rev 0)
+++ grass-addons/grass7/gui/wxpython/wx.wms/image.py 2011-07-08 00:24:13 UTC (rev 47054)
@@ -0,0 +1,21 @@
+import wx
+import cStringIO
+
+class ImagePanel(wx.Panel):
+ def displayImage():
+ try:
+ imageFile = 'map.png'
+ data = open(imageFile, "rb").read()
+ stream = cStringIO.StringIO(data)
+ bmp = wx.BitmapFromImage( wx.ImageFromStream( stream ))
+ wx.StaticBitmap(self, -1, bmp, (5, 5))
+ except IOError:
+ print "Image file %s not found" % imageFile
+ raise SystemExit
+
+def NewImageFrame():
+ app = wx.PySimpleApp()
+ frame = wx.Frame(None, -1, "Map Display", size = (400, 300))
+ ImagePanel(frame1,-1)
+ frame.Show(1)
+ app.MainLoop()
More information about the grass-commit
mailing list