hello All,
I am attaching two scripts. One is readfile.py which is a gui script
where there is a image display panel and a button. Now what i want is when i
click on the button, then it should call a function which is there in second
script clases_calling.py which basically passes the second image file name
to the readfile and it should call imagetobit function of the gui script and
display the passed imagefile name. I am getting runtime errors....
thanks
--
Varsha Purohit,
Graduate Student
from readfile import MainWindow
import os
class funct:
def func_call(self):
imagename = "r10001t0.asc.jpg"
newImage = imagetobit(imagename)
import wx
import os
import IO
import clases_calling
APP_SIZE_X = 700
APP_SIZE_Y = 300
developerData = "developers.txt"
class MainWindow(wx.Frame):
def __init__(self):
wx.Frame.__init__(self,None,-1,"Agent-Based Model of Residential
Development", size = (APP_SIZE_X, APP_SIZE_Y))
## panel = wx.Panel(self,-1)
## wx.StaticText(panel,-1,"first",(35,20))
## self.txtBox1 = wx.TextCtrl(panel,-1,pos=(60,20),size=(30,20))
##
## wx.StaticText(panel,-1,"sec",(95,20))
## self.txtBox2 = wx.TextCtrl(panel,-1,pos=(120,20),size=(30,20))
##
## wx.StaticText(panel,-1,"third",(155,20))
## self.txtBox3 = wx.TextCtrl(panel,-1,pos=(185,20),size=(30,20))
self.panel = wx.Panel(self,-1)
self.imageFile = "r10001t0.asc.jpg"
self.bmp =
wx.Image(self.imageFile,wx.BITMAP_TYPE_JPEG).ConvertToBitmap()
wx.StaticBitmap(self.panel, -1, self.bmp, (20,20), (80,120))
button42 = wx.Button(self.panel, -1, "Read", pos=(240,20))
self.Bind(wx.EVT_BUTTON, self.OnRead,button42)
def OnRead(self,event):
clases_calling.func_call(self)
## self.imageFile1="DSCN3378.jpg"
## self.bmp =
wx.Image(self.imageFile1,wx.BITMAP_TYPE_JPEG).ConvertToBitmap()
## self.obj = wx.StaticBitmap(self.panel, -1, self.bmp, (20,20),
(80,120))
## self.obj.Refresh()
## batch_data = IO.readDevelopers(developerData)
## for model_run in batch_data:
## for rec in batch_data[model_run]:
## self.txtBox1.write(rec.pop(0))
## self.txtBox2.write(rec.pop(0))
## self.txtBox3.write(rec.pop(0))
## self.Destroy()
def imagetobit(imagename):
self.imageFile1=imagename
self.bmp =
wx.Image(self.imageFile1,wx.BITMAP_TYPE_JPEG).ConvertToBitmap()
self.obj = wx.StaticBitmap(self.panel, -1, self.bmp, (20,20), (80,120))
self.obj.Refresh()
app = wx.PySimpleApp()
MainWindow().Show()
app.MainLoop()
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor