app with standalone gui and web interface

Daniel Nogradi nogradi at gmail.com
Tue Oct 3 06:09:15 EDT 2006


> > What would the simplest way to make an application that has both a web
> > interface and runs from behind a web server but also can be used as a
> > standalone app with a gui? More precisely is it possible to avoid
> > creating an html/xml/whatever based web interface for the web version
> > and separately creating a gui (wxpython for example) for the
> > standalone version and instead create a graphical frontend at once
> > that can be used for both?
>
> I was experimenting with something roughly similar a couple of years
> ago. You might find it interesting. What I did may or may not work in
> your case. It depends on what you want to be able to do in the
> application.
>
> I built an application that consisted of some server side Java/JSPs
> that gave out XML. I used two stylesheets to transform the data into
> either HTML (for the web version) or another XML-format called wxWML
> (for the wxPython version). Desktop users accessed the application via
> a custom "webbrowser" that translates the wxWML to wxPython code which
> is executed to generate the GUI. This way, anyone with the wxBrowser
> installed could access the application as if it was a desktop app.
>
> But you should know that this was an experiment. We ended up not using
> it because it felt weird and because there was not much extra gain to
> be had from the desktop part. You should also know that the wxBrowser
> is a HUGE security hole which is a good reason not to use it.
>
> You can still download the code I wrote and a "tutorial" PDF from
> http://www.pulp.se/wx/ but I haven't touched it since last summer so
> I'm not sure it works with the latest version of wxPython. Also, I just
> noted that the example URL that I point to on that page doesn't work
> because I've moved my hosting since then, but that can be fixed.


Thanks for the suggestions, I'll look into both methods. Having a
local webserver seems pretty easy and convenient.

Johan, your way of doing it resembles XUL somewhat, although I can't
say I fully understand XUL I just took a look some days ago. Let me
see if I understand your approach:

If you want to have something very dynamical you do it the way you
described with the wxwml source getting parsed, converted to wxpython
and then run by python all at once. At the same time the webserver can
fetch the same wxwml source, convert it into html/xml and send that to
the web client. Now if one wants to bypass wxbrowser and the real time
conversion to wxpython, then, sacrificing some level of dynamicness,
why not convert the wxwml source 'statically' into wxpython, bundle
that as an app and at the same time convert it also to xml/html
'statically' and have that served by a webserver. In this way any time
the gui changes one needs to go through both convertions once, bundle
the desktop app again, update the webserver but there won't be any
security whole or any magic that is not pure python or not pure
html/xml. Does this sound reasonable or am I misunderstanding
something?

In fact something like that is the thing I'm looking for, some
language that can specify a gui and can be used to generate
'statically' both wxpython source (or some other widget set) or
html/xml source.



More information about the Python-list mailing list