views:

279

answers:

5

I want to create an application that runs on the users computer, a stand-alone application, with installation and what-not, but I want the interface to be a browser, either internal and displayed as an OS window or external accessible using the browser (i.e. some http server).

The reason would be because I know a little about Python, but I think I can manage as long as I have some basic roots that I can use and manipulate, and those would be HTML, CSS, and Javascript.

I've yet to find a good GUI tool which I can use, and always abandon the idea after trying to mess around and eventually not getting anything.

+1  A: 

You could use Pyjamas. It's a port of Google Web Toolkit to Python, which basically means you write in Python and it gets compiled to HTML and JS.

Matthew Flaschen
It's dead.Sounds good though...
Eli
Except it isn't, since its latest commit was only a couple of weeks ago.
Ignacio Vazquez-Abrams
hmmm, the site was dead last night when I checked :) now it's working...
Eli
A: 

There are plenty of excellent GUI tools for the way you want to do your GUI -- HTML, CSS, and Javascript. If you don't know of any, ask in a separate question with the right tags.

The Python side in such an arrangement should have no GUI of its own, but just run a subclass of the Python's standard library's HTTP server, just serving the HTML, CSS, and JS files, and data via JSON on other URLs that the JS can reach with Ajax techniques, essentially implementing storage and business logi -- so it's far from obvious what "GUI tool" you could possibly want for it?!

Just develop the Python side on its own (e.g. with IDLE, Wingware, SPE, or whatever you like) and the HTML / CSS / Javascript separately, with its own "GUI tool". All that Python will do with those files is statically serve them, after all.

You could be thinking of using some Python side templating, such as Mojo &c, but my recommendation is to avoid that: rather, go with the "thin server architecture" all the way, make the Python side a RESTful server of business logic and storage layers, and do all the GUI work in the browser instead.

Alex Martelli
This is one way, but other languages (e.g. .NET ones) have libraries that allow easy embedding of a browser into a window and scripting it or communicating via a simple API. I've found that useful on several occasions myself, but have been unable to find an equivalent in Python. wxPython has a browser widget, but it's quite outdated and doesn't even support scripting IIRC. Tk has nothing. There's a Webkit embedding for one of the GUI toolkits, but it's a severe pain in the behind to compile and integrate.
Max Shawabkeh
I think I'm looking for what Max is talking about, an embedded browser that can communicate directly via JS API with the desktop application.
Eli
A: 

I suggest you use PHP instead. Its easy to set up with a web server eg Xampp. Since you are using browsers, you can easily set up your GUI(using basic radiobuttons, checkboxes, textarea etc ) using just some HTML etc. There is also no need to install anything on your users PC, since the browser is the only thing they need.

But it's not packable and not easily distributable.
Eli
why do you need to distribute ? I already said, the user need to just have their browsers. Your application runs off a webserver. You GUI interface will be the web browser.
+1  A: 

Python offers two things that should be of your interest:

  • a web server in the standard library
  • a standartized interface for web applications, called WSGI

So it is relatively easy to add a web interface to your application. For example in Mercurial (the versioning system), you have a command hg serve that launches a web server.

To see python launching a web server, and a WSGI app, just do:

python -m 'wsgiref.simple_server'

You can look at the wsgiref source code or some WSGI tutorial to do a simple app.

After that, you may want to use a web framework (for templating & co), but that is another question...

Piotr Lesnicki
This seems to answer my question.Thanks :)
Eli
A: 

Are you resorting to a web browser only because you've had difficulty with Python widget toolkits, like Tkinter,wxpython, and pyqt?

Have you tried Qt Designer? It's a graphical GUI designer, making it very quick and easy to develop great looking GUI's. It gets installed automatically with PyQt.

http://www.riverbankcomputing.co.uk/software/pyqt/download

Brendan Abel
Yes and no.I do have a problem with the GUI toolkits, and for me, as a web developer, it's much easier to get going with standard HTML and JavaScript.Isn't Qt only works for non-commercial applications if I don't have Qt license?
Eli
@Eli, Qt has a dual LGPL/Commercial license. Basically, if you plan on publishing your application, you either need to open source it, or get a commercial license.
Brendan Abel