I am working on a GUI program that some parts write in wxpython and some parts in css, html and javascript
Below are the codes taken from http://wxpython.org/Phoenix/docs/html/MemoryFSHandler.html#memoryfshandler
def OnAbout(self, event):
bcur = wx.BeginBusyCursor()
wx.FileSystem.AddHandler(wx.MemoryFSHandler)
wx.MemoryFSHandler.AddFile("logo.pcx", wx.Bitmap("logo.pcx", wx.BITMAP_TYPE_PCX))
wx.MemoryFSHandler.AddFile("about.htm",
"<html><body>About: "
"<img src=\"memory:logo.pcx\"></body></html>")
dlg = wx.Dialog(self, -1, _("About"))
topsizer = wx.BoxSizer(wx.VERTICAL)
html = wx.html.HtmlWindow(dlg, size=wx.Size(380, 160), style=wx.HW_SCROLLBAR_NEVER)
html.SetBorders(0)
html.LoadPage("memory:about.htm")
html.SetSize(html.GetInternalRepresentation().GetWidth(),
html.GetInternalRepresentation().GetHeight())
topsizer.Add(html, 1, wx.ALL, 10)
topsizer.Add(wx.StaticLine(dlg, -1), 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 10)
topsizer.Add(wx.Button(dlg, wx.ID_OK, "Ok"),
0, wx.ALL | wx.ALIGN_RIGHT, 15)
dlg.SetAutoLayout(True)
dlg.SetSizer(topsizer)
topsizer.Fit(dlg)
dlg.Centre()
dlg.ShowModal()
wx.MemoryFSHandler.RemoveFile("logo.pcx")
wx.MemoryFSHandler.RemoveFile("about.htm")
These codes show how:
- add MemoryFSHandler and load the HTML string into the memory stream instead of placing html codes in the file and calling this file
- Also this example is based on an html widget and not a web browser widget
Below are my codes (trial version and error)
class About(wx.Frame):
def __init__(self):
wx.Panel.__init__(self,None,-1,title="This is a working example",size=(700,700))
class Test(wx.Frame):
"""Contact author: contribute a word or send a occurences of bugs"""
def __init__(self,title,pos,size):
wx.Frame.__init__(self,None,-1,title,pos,size)
self.tester=wx.html2.WebView.New(self)
wx.FileSystem.AddHandler(wx.MemoryFSHandler())
wx.MemoryFSHandler().AddFile("about.js","""
document.write("IT is working")
""")
self.tester.LoadURL("memory:about.htm")
I tried to find some examples on the Internet, but was unsuccessful
Question
-. html / (, URI ":....." ), webview html-