Using a browser as a GUI: which Python package

  • Thread starter =?iso-8859-1?B?QW5kcuk=?=
  • Start date
?

=?iso-8859-1?B?QW5kcuk=?=

First, an apology: I realise that I don't know enough about what I am
asking to make sure to use the proper language to phrase my question.

I would like to use a browser (e.g. Firefox) as a simple GUI
"framework". Note that this is to be done on a single user machine, so
the question of sandboxing is not really relevant here.

The simplest application I would like to start with would be one with
two "windows" (within a browser window) and a single button. One
window would be used as a Python code editor; the other as an output
window. On clicking on the button, the code in the editor window would
be run by Python with the result appearing in the output window.

[A more advanced, future version, would be to have Python create some
graphical code (e.g. SVG) that could be passed to the browser to be
displayed within the output window.]

Ideally, I would prefer a Python-based solution only.

My ultimate goal would be to port the main features of two
wxPython-based apps I wrote (rur-ple and Lightning Compiler, both found
at https://sourceforge.net/project/showfiles.php?group_id=125834)
within a standard browser.

Any help/pointers would be appreciated.

André
 
J

John Bokma

André said:
First, an apology: I realise that I don't know enough about what I am
asking to make sure to use the proper language to phrase my question.

I would like to use a browser (e.g. Firefox) as a simple GUI
"framework". Note that this is to be done on a single user machine, so
the question of sandboxing is not really relevant here.

The simplest application I would like to start with would be one with
two "windows" (within a browser window) and a single button. One
window would be used as a Python code editor; the other as an output
window. On clicking on the button, the code in the editor window would
be run by Python with the result appearing in the output window.

[A more advanced, future version, would be to have Python create some
graphical code (e.g. SVG) that could be passed to the browser to be
displayed within the output window.]

Ideally, I would prefer a Python-based solution only.

I guess you need at least AJAX to make it smooth. (Otherwise if you press
the button, your window is refreshed.)

But other then that: a form with text area + submit button, and a result
part should do the trick. If you want a "real" editor a lot of JavaScript
it needed to make it work.

Also note that if your result takes some time you need to send dummy
headers every now and then to keep the connection alive. And even then
there might be problems with time outs.
 
?

=?iso-8859-1?B?QW5kcuk=?=

John said:
I would like to use a browser (e.g. Firefox) as a simple GUI
"framework". Note that this is to be done on a single user machine, so
the question of sandboxing is not really relevant here.
[snip]

Ideally, I would prefer a Python-based solution only.

I guess you need at least AJAX to make it smooth. (Otherwise if you press
the button, your window is refreshed.)

But other then that: a form with text area + submit button, and a result
part should do the trick. If you want a "real" editor a lot of JavaScript
it needed to make it work.

Also note that if your result takes some time you need to send dummy
headers every now and then to keep the connection alive. And even then
there might be problems with time outs.

I don't see why I would have problems with timeouts. As I mentioned
(briefly) I want to use this on a single machine i.e. no communication
over the web. Something like htconsole
(http://blog.ianbicking.org/introducing-htconsole.html). I could use
htconsole and the packages it uses as a starting point, but I would
feel that it would be like choosing to use Tkinter for graphics after
seeing a single GUI based app. Before I invest some time in this, I'd
like to have an idea of what the options are.
 
J

John Bokma

André said:
John Bokma wrote:


I don't see why I would have problems with timeouts. As I mentioned
(briefly) I want to use this on a single machine i.e. no communication
over the web.

You use Python for the webserver as well? Then there might be no problem.
But otherwise, Apache has a max time a script is allowed to run before
it's killed. Of course you can increase that time.

As for the dummy headers, AFAIK still needed, otherwise the browser might
give up.
Something like htconsole
(http://blog.ianbicking.org/introducing-htconsole.html). I could use
htconsole and the packages it uses as a starting point, but I would
feel that it would be like choosing to use Tkinter for graphics after
seeing a single GUI based app. Before I invest some time in this, I'd
like to have an idea of what the options are.

I am quite new to Python, but have some idea of the other things you
probably require :)
 
J

John J. Lee

André said:
I would like to use a browser (e.g. Firefox) as a simple GUI
"framework". Note that this is to be done on a single user machine, so
the question of sandboxing is not really relevant here. [...]
My ultimate goal would be to port the main features of two
wxPython-based apps I wrote (rur-ple and Lightning Compiler, both found
at https://sourceforge.net/project/showfiles.php?group_id=125834)
within a standard browser.

If you can stick to Firefox, you might find XUL useful. There are
various different styles of development that use XUL and Python -- a
bit of Googling and reading should find them.


John
 
D

Don Taylor

John said:
I would like to use a browser (e.g. Firefox) as a simple GUI
"framework". Note that this is to be done on a single user machine, so
the question of sandboxing is not really relevant here.
[...]

My ultimate goal would be to port the main features of two
wxPython-based apps I wrote (rur-ple and Lightning Compiler, both found
at https://sourceforge.net/project/showfiles.php?group_id=125834)
within a standard browser.


If you can stick to Firefox, you might find XUL useful. There are
various different styles of development that use XUL and Python -- a
bit of Googling and reading should find them.
Bear in mind that I don't know what I am talking about, but I stumbled
across 'ZK' the other day put it on my list of thinkgs to check out. It
provides a range of XUL and XHTML widgets, see:

http://zk1.sourceforge.net/

Has anyone tried this? I would really like to find a GUI toolkit that
allowed me to program XUL in Firefox using Python. ZK is not quite
that, but it looks close.

Don.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top