Please check it out, improve it, add better description to the Wiki page, whatever.
In particular, while I like the wx.MemoryFSHandler() approach, I would like to better understand how the namespaces work when embedding a wx control in an HtmlWindow
For instance, I couldn't figure out how to embed an instance of a wx.StaticBitmap, rather than having to make a custom class -- anyone?
Enjoy,
-Chris
···
--
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
Since you need to pass a wx.Bitmap to the wx.StaticBitmap constructor and since the wxp tag handler doesn't have the smarts to be able to take a path name and convert it to a bitmap for you, then using a custom class is probably the only way to do it as it stands now.
In a nutshell, the wxp tag simply looks up the given class name in the given module, makes a dictionary out of the <param> tags specified and then calls the class passing those as keyword args. The HtmlWindow widget then manages things like the size and placement of the widget created by the wxpTag code.
Of course creating new tag handlers is always an option if you want to do more than that.
···
On 9/18/09 1:52 PM, Christopher Barker wrote:
In particular, while I like the wx.MemoryFSHandler() approach, I would
like to better understand how the namespaces work when embedding a wx
control in an HtmlWindow
For instance, I couldn't figure out how to embed an instance of a
wx.StaticBitmap, rather than having to make a custom class -- anyone?
In particular, while I like the wx.MemoryFSHandler() approach, I would
like to better understand how the namespaces work when embedding a wx
control in an HtmlWindow
For instance, I couldn't figure out how to embed an instance of a
wx.StaticBitmap, rather than having to make a custom class -- anyone?
Since you need to pass a wx.Bitmap to the wx.StaticBitmap constructor and since the wxp tag handler doesn't have the smarts to be able to take a path name and convert it to a bitmap for you,
well, I was thinking along the lines of having a wx.StaticBitmap instance that already had its bitmap, and passing that in. But I guess that wxHTML is expecting to instantiate the class?
But it's nice to know that my kludge is as good as it gets.
In a nutshell, the wxp tag simply looks up the given class name in the given module, makes a dictionary out of the <param> tags specified and then calls the class passing those as keyword args.
here is the key -- what namespace does that dictionary get build using? If I could access that namespace, I could put a pre-build wx.Bitmap in it.
Of course creating new tag handlers is always an option if you want to do more than that.
I'll keep that in mind -- for this purpose, I think the wx.MemoryFSHandler() approach is the elegant solution.
I'll add a bit more note to the Wiki,
-Chris
···
On 9/18/09 1:52 PM, Christopher Barker wrote:
--
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
In particular, while I like the wx.MemoryFSHandler() approach, I would
like to better understand how the namespaces work when embedding a wx
control in an HtmlWindow
For instance, I couldn't figure out how to embed an instance of a
wx.StaticBitmap, rather than having to make a custom class -- anyone?
Since you need to pass a wx.Bitmap to the wx.StaticBitmap constructor
and since the wxp tag handler doesn't have the smarts to be able to take
a path name and convert it to a bitmap for you,
well, I was thinking along the lines of having a wx.StaticBitmap
instance that already had its bitmap, and passing that in. But I guess
that wxHTML is expecting to instantiate the class?
Yes. Well, it's done in the tag handler and it is designed to do the instantiation itself. I suppose that a different tag handler could be written that just makes a placeholder widget that can be replaced later, or something like that.
But it's nice to know that my kludge is as good as it gets.
In a nutshell, the wxp tag simply looks up the given class name in the
given module, makes a dictionary out of the<param> tags specified and
then calls the class passing those as keyword args.
here is the key -- what namespace does that dictionary get build using?
If I could access that namespace, I could put a pre-build wx.Bitmap in it.
See wx.lib.wxpTag. When it sees the opening <wxp> tag it creates an instance of _Context for storing the details found along the way. It uses the instance's __dict__ for the globals in the eval.
In a nutshell, the wxp tag simply looks up the given class name in the
given module, makes a dictionary out of the<param> tags specified and
then calls the class passing those as keyword args.
here is the key -- what namespace does that dictionary get build using?
If I could access that namespace, I could put a pre-build wx.Bitmap in it.
See wx.lib.wxpTag. When it sees the opening <wxp> tag it creates an instance of _Context for storing the details found along the way. It uses the instance's __dict__ for the globals in the eval.
So I should be able to patch something in there if I wanted it to be found. But for now, I don't need it, but I'll remember to look there if I ever do!
-Chris
···
--
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