I found a few basic examples on how to source a remote webpage like here
http://stackoverflow.com/a/10866495/784637
import wx
import wx.html2
class MyBrowser(wx.Dialog):
def init(self, *args, **kwds):
wx.Dialog.init(self, *args, **kwds)
sizer = wx.BoxSizer(wx.VERTICAL)
self.browser = wx.html2.WebView.New(self)
sizer.Add(self.browser, 1, wx.EXPAND, 10)
self.SetSizer(sizer)
self.SetSize((700, 700))
if name == ‘main’:
app = wx.App()
dialog = MyBrowser(None, -1)
dialog.browser.LoadURL(“http://www.google.com”)
dialog.Show()
app.MainLoop()
But I haven’t found any examples of presenting an .htm file from the local filesystem.
I read “Virtual File Systems and Custom Schemes” but wasn’t able to find any working examples of presenting a local .htm file.
http://wxpython.org/Phoenix/docs/html/html2.WebView.html#phoenix-title-virtual-file-systems-and-custom-schemes
Does anyone know how to do this?
Did you try a file url? : file://the_path/to/the/file.html
I haven't but it's the first thing I'd try...
-CHB
···
On Thu, Feb 6, 2014 at 3:53 PM, RedHotChiliPepper < sharrukinjosephson@gmail.com> wrote:
I found a few basic examples on how to source a remote webpage like here
if __name__ == '__main__':
app = wx.App()
dialog = MyBrowser(None, -1)
dialog.browser.LoadURL("http://www.google.com")
dialog.Show()
app.MainLoop()
But I haven't found any examples of presenting an .htm file from the local
filesystem.
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov
I just tried that an it didn’t work
···
On Thursday, February 6, 2014 7:20:54 PM UTC-5, Chris Barker wrote:
On Thu, Feb 6, 2014 at 3:53 PM, RedHotChiliPepper sharrukin...@gmail.com wrote:
I found a few basic examples on how to source a remote webpage like here
if name == ‘main’:
app = wx.App()
dialog = MyBrowser(None, -1)
dialog.browser.LoadURL(“http://www.google.com”)
dialog.Show()
app.MainLoop()
But I haven’t found any examples of presenting an .htm file from the local filesystem.
Did you try a file url? : file://the_path/to/the/file.html
I haven’t but it’s the first thing I’d try…
-CHB
–
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris....@noaa.gov
On a phone here, but the next thing I’d try is reading the file, then calling SetPage with the contents.
Chris
···
On Feb 6, 2014, at 3:54 PM, RedHotChiliPepper sharrukinjosephson@gmail.com wrote:
I found a few basic examples on how to source a remote webpage like here
http://stackoverflow.com/a/10866495/784637
import wx
import wx.html2
class MyBrowser(wx.Dialog):
def init(self, *args, **kwds):
wx.Dialog.init(self, *args, **kwds)
sizer = wx.BoxSizer(wx.VERTICAL)
self.browser = wx.html2.WebView.New(self)
sizer.Add(self.browser, 1, wx.EXPAND, 10)
self.SetSizer(sizer)
self.SetSize((700, 700))
if name == ‘main’:
app = wx.App()
dialog = MyBrowser(None, -1)
dialog.browser.LoadURL(“http://www.google.com”)
dialog.Show()
app.MainLoop()
But I haven’t found any examples of presenting an .htm file from the local filesystem.
I read “Virtual File Systems and Custom Schemes” but wasn’t able to find any working examples of presenting a local .htm file.
http://wxpython.org/Phoenix/docs/html/html2.WebView.html#phoenix-title-virtual-file-systems-and-custom-schemes
Does anyone know how to do this?
–
You received this message because you are subscribed to the Google Groups “wxPython-users” group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Generally a local file URL would actually include 3 / characters:
file:///c:\temp\zExample.txt
Jacob Kruger
Blind Biker
Skype: BlindZA
‘…fate had broken his body, but not his spirit…’
···
----- Original Message -----
From:
RedHotChiliPepper
To: wxpython-users@googlegroups.com
Sent: Friday, February 07, 2014 02:58 AM
Subject: Re: [wxPython-users] How do you present a local .htm file with css and javascript using wx.html2?
I just tried that an it didn’t work
On Thursday, February 6, 2014 7:20:54 PM UTC-5, Chris Barker wrote:
On Thu, Feb 6, 2014 at 3:53 PM, RedHotChiliPepper sharrukin...@gmail.com > > wrote:
I found a few basic examples on how to source a remote webpage like here
if name == ‘main’:
app = wx.App()
dialog = MyBrowser(None, -1)
dialog.browser.LoadURL(“http://www.google.com”)
dialog.Show()
app.MainLoop()
But I haven't found any examples of presenting an .htm file from the local filesystem.
Did you try a file url? : file://the_path/to/the/file.html
I haven’t but it’s the first thing I’d try…
-CHB
–
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris....@noaa.gov
–
You received this message because you are subscribed to the Google Groups “wxPython-users” group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Ah - I wasn’t providing a raw string like r’file://the_path/to/the/file.html’
thanks all
···
On Thursday, February 6, 2014 6:53:57 PM UTC-5, RedHotChiliPepper wrote:
I found a few basic examples on how to source a remote webpage like here
http://stackoverflow.com/a/10866495/784637
import wx
import wx.html2
class MyBrowser(wx.Dialog):
def init(self, *args, **kwds):
wx.Dialog.init(self, *args, **kwds)
sizer = wx.BoxSizer(wx.VERTICAL)
self.browser = wx.html2.WebView.New(self)
sizer.Add(self.browser, 1, wx.EXPAND, 10)
self.SetSizer(sizer)
self.SetSize((700, 700))
if name == ‘main’:
app = wx.App()
dialog = MyBrowser(None, -1)
dialog.browser.LoadURL(“http://www.google.com”)
dialog.Show()
app.MainLoop()
But I haven’t found any examples of presenting an .htm file from the local filesystem.
I read “Virtual File Systems and Custom Schemes” but wasn’t able to find any working examples of presenting a local .htm file.
http://wxpython.org/Phoenix/docs/html/html2.WebView.html#phoenix-title-virtual-file-systems-and-custom-schemes
Does anyone know how to do this?
Yes, generally you read the file in, then pass it to the WebView, as a raw string so possible escape sequences dont screw up anything in rendering.
Local files you will want to add the ‘file//’ to the beginning of the path.
···
On Friday, February 7, 2014 2:42:42 AM UTC-6, RedHotChiliPepper wrote:
On Thursday, February 6, 2014 6:53:57 PM UTC-5, RedHotChiliPepper wrote:
I found a few basic examples on how to source a remote webpage like here
http://stackoverflow.com/a/10866495/784637
import wx
import wx.html2
class MyBrowser(wx.Dialog):
def init(self, *args, **kwds):
wx.Dialog.init(self, *args, **kwds)
sizer = wx.BoxSizer(wx.VERTICAL)
self.browser = wx.html2.WebView.New(self)
sizer.Add(self.browser, 1, wx.EXPAND, 10)
self.SetSizer(sizer)
self.SetSize((700, 700))
if name == ‘main’:
app = wx.App()
dialog = MyBrowser(None, -1)
dialog.browser.LoadURL(“http://www.google.com”)
dialog.Show()
app.MainLoop()
But I haven’t found any examples of presenting an .htm file from the local filesystem.
I read “Virtual File Systems and Custom Schemes” but wasn’t able to find any working examples of presenting a local .htm file.
http://wxpython.org/Phoenix/docs/html/html2.WebView.html#phoenix-title-virtual-file-systems-and-custom-schemes
Does anyone know how to do this?
Ah - I wasn’t providing a raw string like r’file://the_path/to/the/file.html’
thanks all