views:

137

answers:

7

different languages have different GUI toolkits but It looks very difficult to achieve attractive user interfaces as good as we can using HTML and css with less effort. I dont my application in javascript as I doubt if it has all the required libraries and i want to do it in python.

How do I use rendering engines like gecko,webkit etc in python? which one will be more suited to work with python?. Is there any 'only html/css' rendering engine without javascript?

Will it be easy to write event handlers for DOM events and manipulate DOM in python?

+1  A: 

There are a couple of ways you might want to go about this: the most simple would probably be to use something like Adobe AIR, which is basically a Webkit rendering engine with an extended javascript engine, which allows you to program in more complex functionality.

Otherwise you could check out the wxWebConnect project, which is aimed at enabling "developers to quickly integrate advanced Web browser capabilities into their own applications." and is provided as a wxWidgets control library, which is something most python developers should be familiar with. It integrates the Mozilla Gecko rendering engine into your application.

Andrew Dunn
A: 

If you had asked about one back-end language in particular, I would have left this response as a comment rather than a full-fledged question. However, the question is extremely broad... asking about use of an HTML/CSS interface in one of four back-end languages.

That being the case, you should just do a series of web searches on:

"html renderer" [insert-language-here]

... and spend some time browsing through the various options available for embedding an HTML/CSS interface into a back-end language application.

Ultimately, you are mostly likely going to wind up using Mozilla's Gecko renderer... either in its raw form, or indirectly through one of the numerous libraries that provide dev-friendly wrappers around it.

Speaking of Mozilla technologies, you might also want to check out XULRunner (lets you easily throw together a UI using XML with CSS and JavaScript), or maybe even Prism (takes an app running on an HTTP server and presents it to the user as a desktop app).

Steve Perkins
+1  A: 

You should check out Mozilla's XUL project. It allows you to build apps with the ease of HTML and "style" the GUI with actual CSS.

Kyle Sevenoaks
+1  A: 

Find a lightweight server, or better - embed one in Your application. That's it.

Java has classes for serving http. Python does it well also.

See how mercurial's hg serve works. [python]

I once did a tiny app that served aspell spellcheck via http on localhost in java with the httprequest class. [worked on win and linux]

Create Your application as a server that outputs some html and uses POST to do actions. Do the interface thing in HTML+CSS+JS. Nice and easy.

After running point the user to localhost:somesillyport or trigger opening localhost:somesillyport in a browser.

naugtur
A: 

You may be interested by Pyjamas

luc
A: 

Remote Control Toolkit does this, basically. It allows you to write desktop (programming) style applications that render in a browser display.

Even though it attempts to hide html/css/js details for you, you can extend the system with new widgets or extend existing ones, using basically everything that html(5), css, js offers.

Unlike Pyjamas or GWT, it doesn't compile to javascript. Your code remains serverside and you can basically do anything you are used to do (open files, open connections, keep state, and so on)

Ivo van der Wijk
A: 

To supplement the options already given by others:

Some webkit bindings:

  • qtwebkit (for pyqt or pyside)
  • wxwebkit (not quite ready yet, but there is a prerelease for wxpython available)
  • pywebkitgtk (don't know how easy it is to get it on Windows)

As for gecko/mozilla, you might have a look at PyXPCOM, probably via pyxpcomext. The difference here - if I understand it correctly - is that rather than using mozilla from within python, python gets embedded in mozilla. But it should be possible to make a xulrunner application that can use python.

Steven