Two more questions, and a comment: Cross-Platform...

Dave Wald res04o20 at gte.net
Sun Jun 17 23:27:11 EDT 2001


Me again... ;-)

Hint: Turn the problem around. Instead of trying to host Tkinter or wxPython
windows in a browser, host the browser in your windows, just like IE does,
for example. IE is just a container for two MS Active-X controls,
shdocvw.dll and mshtml.dll. The first is called the WebBrowser control, and
it in turn hosts the HTML parser. Again, I think there is an example of this
in one of the books I mentioned earlier. At any rate, I think you would have
better luck with this approach using wxPython than Tkinter, since it is
C++-based to begin with.

But at any rate...

> 1. Is Tkinter likely to be ported over to MacOS X soon?

No idea. No speaky Mac.

> 2. Is Tkinter gui-code usable in any kind of web scripting? In other
words,
> are forms and tables generated in Tkinter usable to gather user input
> through web browsers and can Tkinter be used to output data to web
browsers?
> I think not???

Short answer: No. Not "through" the browser.
    Here is how I would approach this. I don't see any reason you could not
simply use your Tkinter or wxPython objects from within script blocks in a
(D)HTML page. Once you're in Python, you're IN Python. Put them in a
separate module in your application package and import what you need. The
windows should just pop up in front of the browser, just like an alert or a
VBScript Msgbox. Get your user input and truck on.
(Marketing alert: It's usually not a good idea to mix UI paradigms, it may
confuse your users/customers. And they do NOT like feeling confused...
believe me. But, Microsoft Money does it all over the place...<shrug> )
The only technical problem I can see here is threading. Since you are
running in the same process with the browser, and in this scenario the
browser is the host, you might have to run your Tk or wx windows on a
separate thread, but I doubt it. Same potential problem as running Tkinter
modules from within PythonWin, but that's another story... This gets real
technical, and may not be worth the trouble, but really should not be too
difficult using one of the threading modules available, if you HAVE to. Here
again, I'm not a guru on this aspect by any means, yet, (I'll probably have
to become one before it's all over), but it should work just fine. But
again, if you turn the problem around as above, and host the browser control
in YOUR window, there should not be ANY problems. I would investigate the
pure-Python-based examples of this first, since it sounds like
cross-platform is a major concern for you. Again, I apologize for my
Windows-centric approach to all of this, but all of our customers are
Windows, so that's the focus I know best at this point. But I KNOW I've seen
an example of the pure Python approach, probably in the PP2E book.

>
>     (OK I know I'm cheating, but two more closely related sub-questions)
>
> 1a. Is wxPython likely to be ported over to the Mac OS X opsys soon?
Sooner
> or later than Tkinter?

Again, no idea. I would suspect sooner. Just gut feel. The wx guys are
hungrier. ;-)
But really, I would ask them if it's a serious concern.

> 2a. Is wxPython code usable in any kind of web scripting?
>

Same deal as above, just might be a little cleaner, since there is no Tcl
layer.

Regards,

Dave





More information about the Python-list mailing list