Given the built-in file/stream support in Python, why would you waste any time with wx's stream stuff?
wxFileInputStream exists in wxWidgets because file I/O can be non-intuitive in C/C++. The same is not true in Python.
···
On Sat, 13 Nov 2004 23:42:28 -0800, "Roger Binns" <rogerb@rogerbinns.com> wrote:
Since wx.FileInputStream isn't wrapped, I had to create
my own which creates a subclass of wx.InputStream and passed
it a file object.wx.InputStream doesn't provide a method to get the size of
the object so I worked it out by seeking to the end and
using tell.This worked fine in 2.5.2.8, but returns zero in 2.5.3.1.
The following code shows the issue. Supply a command line
argument consisting of any existing filename.import wx
class FileInputStream(wx.InputStream):
def __init__(self, name):
self.f=open(name, "rb")
wx.InputStream.__init__(self,self.f)import sys
stream=FileInputStream(sys.argv[1])
print "seek returns",stream.SeekI(0, wx.FromEnd)
print "tell returns",stream.TellI()
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.