wx.html and wx.TextCtrl

Hmm, I have a question that seems similar to me:

How do I use wx.html.HtmlWindow and wx.TextCtrl on the same panel or frame?

My idea is to have flexible display options on the above panel and a text
prompt beneath it all (I want a wx.TextCtrl for the text prompt—not an HTML
form).

···

--
View this message in context: http://www.nabble.com/split-a-frame-in-two-panels-doing-things-tp17974936p23455842.html
Sent from the wxPython-users mailing list archive at Nabble.com.

Cordilow wrote:

Hmm, I have a question that seems similar to me:

How do I use wx.html.HtmlWindow and wx.TextCtrl on the same panel or frame?

Just give them the same parent, use a sizer to manage the layout, and use event handlers to tie them together however you need it.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Thanks. I wasn't adding the parent as a parameter. Works fine now. I just
wish I could use styles so that I could get larger text and other such.

Robin Dunn wrote:

···

Cordilow wrote:

Hmm, I have a question that seems similar to me:

How do I use wx.html.HtmlWindow and wx.TextCtrl on the same panel or
frame?

Just give them the same parent, use a sizer to manage the layout, and
use event handlers to tie them together however you need it.

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

--
View this message in context: http://www.nabble.com/split-a-frame-in-two-panels-doing-things-tp17974936p23466734.html
Sent from the wxPython-users mailing list archive at Nabble.com.

Cordilow wrote:

Thanks. I wasn't adding the parent as a parameter. Works fine now. I just
wish I could use styles so that I could get larger text and other such.

yes, a full featured HTML widget would be nice (And there is one in progress -- see wxWebKit)

In the meantime, you can set text sizes etc, using old-style html, and you can globally change the defaults. Poke around for docs and examples...

-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

Chris.Barker@noaa.gov

Thanks for the note on wxWebKit! That's really good to hear.

About the text size, though, I know I can set it with normal HTML, but it
only gets so big (and 'so big' is not extremely large in this case).

I'm beginning to realize, though, that I might need something else to pull
off exactly what I want. I need certain things that are found in Visual
Novels and other such video games, too. For instance, the ability to layer
images (transparent PNG character art over the background art and such), put
text boxes (transparent or not) over both of those, and such. Transitions
would also be nice.

So, I've thought about it and discussed things with a friend. He suggested
PythonMagick, and although that would be well and good, apparently it
doesn't work on my Ubuntu installation (though it says it's installed; it
gives me errors, and if it gives me errors it will probably give some of my
audience errors, and I don't want them to have to deal with that—and they
would have to, if they had to install the dependencies themselves: just a
plug for compiled executables). So, I've thought about using the Python
Imaging Library instead, but I'm not sure what I can do with text on that.
The idea is to have the text drawn with the images as one image and just
change the image every time something needs to change. I've thought about
using GhostScript, but I'm not really sure where to start with that.

I've thought about using SDL and OpenGL in WxPython, but dealing with the
text would likely be difficult, although it would make it easier to make
text appear letter by letter.

I've thought about scrapping the Python route and just using C++—it might be
easier to find what I want that way, although it would probably be more work
(especially since I haven't worked with C++ a ton); plus there's the
cross-platform thing to consider.

It would be nice if they had a software development environment with visual
capabilities similar to Flash's (especially with layering and frames;
symbols as they work there would be great, too). I'd love to see something
like Flash using Python instead of ActionScript. Imagine the Visual Basic
environment with Python as the language, and the visual organization power
of Flash.

The real problem with Flash, though, is that it's designed for websites and
saving data to the computer requires things I'd rather not be required (plus
Flash isn't free software). I have heard of and tried Flash for Linux,
though (which isn't an Adobe product, but rather a free product), but it
still has some kinks to work out (or it did the last time I checked). Come
to think of it, Flash didn't have very extensive text capabilities either:
that one area wherein it falls short. The thing I'm envisioning would allow
for all that LaTex, word processors, and visual novel engines (such as
Ren'Py) can handle.

Hmm, now that I'm done dreaming, anyone have any more advice? I'd like to
keep going with WxPython, and do pure Python code, but if you have other
ideas, feel free to voice them.

···

--
View this message in context: http://www.nabble.com/split-a-frame-in-two-panels-doing-things-tp17974936p23496970.html
Sent from the wxPython-users mailing list archive at Nabble.com.

Cordilow wrote:

Thanks for the note on wxWebKit! That's really good to hear.

It is moving forward, though not as fast as we'd all like!

I'm beginning to realize, though, that I might need something else to pull
off exactly what I want. I need certain things that are found in Visual
Novels and other such video games, too. For instance, the ability to layer
images (transparent PNG character art over the background art and such), put
text boxes (transparent or not) over both of those, and such. Transitions
would also be nice.

this does go beyond HTML -- though I'm amazed what people can do with HTML+Javascript -- maybe wxWebKIt is worth a look-see for you.

So, I've thought about it and discussed things with a friend. He suggested
PythonMagick,

> ...

plug for compiled executables). So, I've thought about using the Python
Imaging Library instead, but I'm not sure what I can do with text on that.

well, both of these are image processing libs, not really rendering libs -- PIL is pretty limited in its text rendering, though the AggDraw module does very nice rendering. Still not text layout though.

The idea is to have the text drawn with the images as one image and just
change the image every time something needs to change.

That would work - how fast are things changing? If performance isn't a big concern, then there are more options.

I've thought about
using GhostScript, but I'm not really sure where to start with that.

I wouldn't go there!

I've thought about using SDL

check out PyGame, which I think is a python layer on SDL -- my understanding is that it's a good way to deal with raster graphics.

Do you need any of this to be scalable?

I've thought about scrapping the Python route and just using C++—it might be
easier to find what I want that way,

what would that buy you? This is a library issue, really. If there is a C++ lib you could use, maybe python bindings are an option. If not, C++ is just going to make it more work!

It would be nice if they had a software development environment with visual
capabilities similar to Flash's (especially with layering and frames;
symbols as they work there would be great, too).

yup. Flash is pretty nice for this sort of thing

The real problem with Flash, though, is that it's designed for websites and
saving data to the computer requires things I'd rather not be required

Adobe Air (or maybe Titanium) is an option for making desktop apps with Flash -- though you're still stuck with a proprietary tool. Something Flash-like, but scriptable in Python would be nice.

> The thing I'm envisioning would allow

for all that LaTex,

For the text layout, which TeX does much better than most, you can call TeX, and make a PNG out of it -- that's what Matplotlib and the like do.

Matplotlib also has a pure-python mini TeX layout engine, which is being extracted to be a stand alone library for a GSoC project. It's used at this point for small math equations, so I don't know how it handles paragraphs of text. If it doesn't maybe that could be added by you...

Nice text layout is a tough problem.

There is a _very_ primitive text layout engine in wx.lib.floatcanvas, that can make small boxes of text. Perhaps you could build on that.

Hmm, now that I'm done dreaming, anyone have any more advice? I'd like to
keep going with WxPython, and do pure Python code, but if you have other
ideas, feel free to voice them.

HTH,

-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

Chris.Barker@noaa.gov

From my grasp of what your trying to do I would suggest looking at SVG, Its the easiest way I know of generating something rich in graphics and text and you can manipulate it on the fly in JavaScript from a webbrowser, write it using basic xml processing in python and use a tool like inkscape to generate complex stuff or to get a feel of what your XML should look like.

I am just a novice with wxpython at the moment so I am not sure how you go about getting what you want into a widget but its got to be easier then a few of those options.

Hope thats useful to you

Jason

···

On Wed, 13 May 2009 09:26:37 +1000, Christopher Barker <Chris.Barker@noaa.gov> wrote:

Cordilow wrote:

Thanks for the note on wxWebKit! That's really good to hear.

It is moving forward, though not as fast as we'd all like!

I'm beginning to realize, though, that I might need something else to pull
off exactly what I want. I need certain things that are found in Visual
Novels and other such video games, too. For instance, the ability to layer
images (transparent PNG character art over the background art and such), put
text boxes (transparent or not) over both of those, and such. Transitions
would also be nice.

this does go beyond HTML -- though I'm amazed what people can do with
HTML+Javascript -- maybe wxWebKIt is worth a look-see for you.

So, I've thought about it and discussed things with a friend. He suggested
PythonMagick,

> ...

plug for compiled executables). So, I've thought about using the Python
Imaging Library instead, but I'm not sure what I can do with text on that.

well, both of these are image processing libs, not really rendering libs
-- PIL is pretty limited in its text rendering, though the AggDraw
module does very nice rendering. Still not text layout though.

The idea is to have the text drawn with the images as one image and just
change the image every time something needs to change.

That would work - how fast are things changing? If performance isn't a
big concern, then there are more options.

I've thought about
using GhostScript, but I'm not really sure where to start with that.

I wouldn't go there!

I've thought about using SDL

check out PyGame, which I think is a python layer on SDL -- my
understanding is that it's a good way to deal with raster graphics.

Do you need any of this to be scalable?

I've thought about scrapping the Python route and just using C++—it might be
easier to find what I want that way,

what would that buy you? This is a library issue, really. If there is a
C++ lib you could use, maybe python bindings are an option. If not, C++
is just going to make it more work!

It would be nice if they had a software development environment with visual
capabilities similar to Flash's (especially with layering and frames;
symbols as they work there would be great, too).

yup. Flash is pretty nice for this sort of thing

The real problem with Flash, though, is that it's designed for websites and
saving data to the computer requires things I'd rather not be required

Adobe Air (or maybe Titanium) is an option for making desktop apps with
Flash -- though you're still stuck with a proprietary tool. Something
Flash-like, but scriptable in Python would be nice.

> The thing I'm envisioning would allow

for all that LaTex,

For the text layout, which TeX does much better than most, you can call
TeX, and make a PNG out of it -- that's what Matplotlib and the like do.

Matplotlib also has a pure-python mini TeX layout engine, which is being
extracted to be a stand alone library for a GSoC project. It's used at
this point for small math equations, so I don't know how it handles
paragraphs of text. If it doesn't maybe that could be added by you...

Nice text layout is a tough problem.

There is a _very_ primitive text layout engine in wx.lib.floatcanvas,
that can make small boxes of text. Perhaps you could build on that.

Hmm, now that I'm done dreaming, anyone have any more advice? I'd like to
keep going with WxPython, and do pure Python code, but if you have other
ideas, feel free to voice them.

HTH,

-Chris

Wow. Thanks for all the input. That should be helpful.

That would work - how fast are things changing? If performance isn't a
big concern, then there are more options.

Not fast at all, really. It shouldn't be processor-intensive. Usually it'll
only be one picture changing, instead of cycling through a series. However,
short animations should still be an option.

check out PyGame, which I think is a python layer on SDL -- my
understanding is that it's a good way to deal with raster graphics.

I like PyGame quite a bit—so that is one thing I'm considering. The main
thing that concerns me there is that I might not be able to resize the
window during run-time—or can it meld with WxPython such that this won't be
a concern? The Ren'Py visual novel engine uses PyGame, anyway, and it does a
lot of what I want.

Do you need any of this to be scalable?

The text needs to be. The background and character art, and such, would be
nice, but not required so much.

I wonder if there's a way to integrate swfc with Python, using Python
instead of ActionScript at chosen times. That would be great, I think. I
could just do that and stick it in a window, using Python to save the files
and such. Of course, I would want stuff in the swf to be able to interact
with stuff outside of it. Is that possible?

what would that buy you? This is a library issue, really. If there is a
C++ lib you could use, maybe python bindings are an option. If not, C++
is just going to make it more work!

Yeah, it would be a whole lot more work. I just figured there would be a
wider variety of graphic-related libraries available in C++. I know there
are tons of Python bindings for things, but not all of them are documented
as well as their C++ equivalents. Plus, executables wouldn't be as hard to
make :stuck_out_tongue: (I sort of know how to make them from Python code, but the more
libraries you introduce, the harder and less reliable it gets.)

Adobe Air (or maybe Titanium) is an option for making desktop apps with
Flash -- though you're still stuck with a proprietary tool. Something
Flash-like, but scriptable in Python would be nice.

Ah, I didn't know that's what Adobe Air and Titanium were all about.
Something like those might work well for me in future, but I don't know if
they're at the point where they will just yet. Titanium looks especially
interesting. Thanks for noting these.

For the text layout, which TeX does much better than most, you can call
TeX, and make a PNG out of it -- that's what Matplotlib and the like do.

Hmm. I have an idea. I was thinking about using TeX and converting it to a
transparent SVG to layer over the other images—however, TeX is a major
dependency, it seems. Therefore, I think it might be a lot easier to try
converting HTML, with styles (without a background color) into a transparent
SVG instead. There has to be some way to convert in this manner through
Python: Do you know of one that might allow for a transparent background?

There is a _very_ primitive text layout engine in wx.lib.floatcanvas,
that can make small boxes of text. …

Sounds interesting. I'll have to check it out. It might be enough.

This link looks interesting for some of my purposes (as it allows CSS and
JavaScript), although it's not WxPython-related:
http://www.aclevername.com/articles/python-webgui/

I just had another idea. I could layer all the images together in a single
image and then just set that as the HTML background image, and the text
could go over it by this means, although I might have to try something such
as the above method to get all the text options I want.

I still need to figure out how to use Python to layer multiple images into
one. I suppose PIL could probably handle that, but would it be the
best/easiest thing to use? I would need to be able to specify position for
the smaller images onto the larger ones, and which images go on which
layers. Then, I would need it to output the resulting image.

Anyway, I'm mostly looking to flesh out ideas right now. I'm not ready for
all the actual display coding. I would like to stick with WxPython for the
GUI, if possible, though, for various reasons (it seems to be the best
documented GUI library in Python, for one—I haven't checked out that
HTML-GUI thing much yet, though).

···

--
View this message in context: http://www.nabble.com/split-a-frame-in-two-panels-doing-things-tp17974936p23517070.html
Sent from the wxPython-users mailing list archive at Nabble.com.

Christopher Barker wrote:

Cordilow wrote:

It would be nice if they had a software development environment with visual
capabilities similar to Flash's (especially with layering and frames;
symbols as they work there would be great, too).

yup. Flash is pretty nice for this sort of thing

The real problem with Flash, though, is that it's designed for websites and
saving data to the computer requires things I'd rather not be required

Adobe Air (or maybe Titanium) is an option for making desktop apps with Flash -- though you're still stuck with a proprietary tool. Something Flash-like, but scriptable in Python would be nice.

Doesn't Silverlight + IronPython fit that bill pretty well? I think it's worth a look anyway. The demos I've seen are pretty cool.

- Mike

Mike Driscoll wrote:

Doesn't Silverlight + IronPython fit that bill pretty well?

I suppose it does -- and there is IronPython+Mono+Moonlight for a (theoretically) fully open source stack.

I've haven't looked at it in any detail at all.

-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

Chris.Barker@noaa.gov

Cordilow wrote:

Wow. Thanks for all the input. That should be helpful.

One more -- PyCairo + Pango. Cairo is a rendering engine, and Pango is a text layout engine -- Ive never used Pango, but there are theoretically python bindings for it. The Cairo bindings are a bit clunky, but they work.

Ah, I didn't know that's what Adobe Air and Titanium were all about.
Something like those might work well for me in future, but I don't know if
they're at the point where they will just yet.

Air seems pretty mature, and Titanium is getting there -- but no Python :frowning:

Hmm. I have an idea. I was thinking about using TeX and converting it to a
transparent SVG to layer over the other images—however,

SVG just gives you another problem -- how to render it? I think you have two issues here, and SVG will solve neither:

How to render
How to layout your text.

You could use Tex to layout your text, and a dvipng to render it to a png, and then something else to render that png. wxDC or wxGraphicsContext would do that part for you.

> TeX is a major dependency, it seems.

yes, this is not a good option is you want to be able to easily re-distribute an app on anything other than Linux, anyway.

> Therefore, I think it might be a lot easier to try

converting HTML, with styles (without a background color) into a transparent
SVG instead.

I think that's just giving you another problem!

If you want to go the HTML route, I'd try wxWebKIt -- maybe it's mature enough for your needs. Otherwise, you can embed the system browser -- the IE engine on Windows and the Safari engine on the Mac -- In theory you can use Gecko on wxGTK, but that's less well supported.

Other than HTML, you can just draw it all yourself with wxGraphicsContext -- this may well be your best bet. The only thing really missing is good text layout, but if your text layout needs are simple, then you can write that without too much pain, maybe by starting with:

There is a _very_ primitive text layout engine in wx.lib.floatcanvas,

IN fact, if you want scalability, FloatCanvas2 is a good start -- it's a re-written version of FloatCanvas, built with alpha blending and transparency and all that fro the start:

It, and some docs, can be found here:

http://svn.wxwidgets.org/svn/wx/wxPython/3rdParty/branches/FloatCanvas/SOC2008_FloatCanvas/floatcanvas2/

and questions and discussion can be found here:

http://mail.paulmcnett.com/cgi-bin/mailman/listinfo/floatcanvas

This link looks interesting for some of my purposes (as it allows CSS and
JavaScript), although it's not WxPython-related:
HOWTO Create Python GUIs using HTML

you can do pretty much the same thing with wxPython+wxWebKit (or the embedded system browsers). I think that's what I call a Browser Interface, Local Server (BILS) app:

http://us.pycon.org/2009/conference/schedule/event/92/

I think it really comes down to how you want to write your app -- mostly HTML-Javascript, or mostly Python.

-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

Chris.Barker@noaa.gov