From: Andreas K. <and...@gm...> - 2009-10-24 12:43:03
|
lostgallifreyan wrote: > Thankyou, that looks comprehensible to me, though I got errors. > (First had to remove the semicolon, then saw 'stream' reported as nil > on line 3). Strange, in the message i sent, there was no semicolon. > I don't know how much context this needs, but it does look like it > needs something else to make it work. It does not need anything else. Just save it to a file and execute it with wxlua on the command line. At least on Linux (wxLua 2.8.10.0) it will print the source of the webpage. Here is an example using a GUI for output: local frame = wx.wxFrame(wx.NULL, wx.wxID_ANY, "wxURL Demo", wx.wxDefaultPosition, wx.wxSize(450, 450), wx.wxDEFAULT_FRAME_STYLE) local textCtrl = wx.wxTextCtrl(frame, wx.wxID_ANY, "", wx.wxDefaultPosition, wx.wxDefaultSize, wx.wxTE_MULTILINE) local url = wx.wxURL("http://www.google.com") local stream = url:GetInputStream() while stream:CanRead() do textCtrl:AppendText(stream:Read(78)) end frame:Show(true) |