Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed last month.
Improve this question
I have been experimenting with Appcelerator Titanum yesterday and I think it's cool when it comes to Javascript.
Python features on Appcelerator Titanum are so limited (can't use some modules for example).
My question is How can I use html & javascript as a GUI tool for a real python application ?
I am running windows 7 and i was thinking of using webkit for that purpose but couldn't know how to work with it in python.
I am planning to make a standalone executable using py2exe as I don't know if the users always have python and the appropriate modules installed.
If you're after webkit bindings for Python, look at PyQt, which includes Webkit, as well as wxWebkit (http://wxwebkit.wxcommunity.com/) if you're using wxWidgets. This lets you embed webkit in a Qt or Wxwidgets app so that you won't have to go through a browser.
If you do use this, then you can either use a web server in Python, like others have mentioned, or you can control the Webkit control directly (though I'm not sure how practical this is).
Beyond that, there's also Pyjamas Desktop (http://pyjs.org/), which lets you use Pyjamas to build the application, then run it.
pywebkitgtk might be what you are looking for.
"HOWTO Create Python GUIs using HTML" http://www.aclevername.com/articles/python-webgui/
http://arstechnica.com/open-source/guides/2009/07/how-to-build-a-desktop-wysiwyg-editor-with-webkit-and-html-5.ars
But I'm not sure if it runs on Windows.
PyQt and Webkit would work on Windows.
http://www.rkblog.rk.edu.pl/w/p/webkit-pyqt-rendering-web-pages/
Here is a nice PyCon talk on the subject.
So how can I use html & javascript as a gui tool for a real python application ?
You run a web server on your desktop. For example, this: http://docs.python.org/library/simplehttpserver.html In a few lines of code you can provide a complete HTTP server that will serve your HTML and Javascript to a browser.
I am running windows 7 and i was thinking of using webkit for that purpose but couldn't know how to work with it in python actually moreover I wanna use py2exe so how can I use python + webkit to handle the gui part ?
Hard to parse that. It either indicates too much coffee or no familiarity with punctuation.
Randomly, I'll pick the following words as possibly being meaningful.
how can I use python + webkit to handle the gui part ?
You run a web server on your desktop. The web server provides html and javascript pages to a browser -- also running on your desktop.
Have you looked at htmlayout? http://terrainformatica.com/htmlayout/main.whtm
PHP Desktop is an open source project founded by Czarek Tomczak in
2012 to provide a way for developing native desktop GUI applications
using web technologies such as PHP, HTML5, JavaScript & SQLite. The
development workflow you are used to while creating web applications
remains the same. The step of turning an existing website into a
desktop application is basically a matter of copying it to the "www/"
directory.
PHP Desktop also releases Python Desktop and Ruby Desktop. It allows you to create a Windows app, that either uses the installed IE for the front-end, or uses an instance of Chrome (so definitely HTML5 support too) that is packaged with the app. It starts a local webserver, supports many databases with a PDO driver and you can layout the views in HTML and Javascript. You can download external resources like any other website/webapp, so it supports network related stuff too. The app ships with its own bare-bones version of Python, you can add libraries as desired.
I looked at all the answers before, as I had the exact same question as you, but PHP Desktop easily solved it for me.
https://code.google.com/p/phpdesktop/wiki/EmbeddingOtherScriptingLanguages
I assume you are mobilizing a web-application for cross platform access.
If so have you considered abstracting the cross platform access at the web-app presentation layer ?
Appcelerator / Webkit does not provide true native look-and-feel on mobile devices but this is where a new technology can help.
If you are thinking about real desktop applications that are multi-threaded and/or use multiple system component - forget about JavaScript. That requires a very good SDK (like PyQt4), and not a basic wrapper like Appcelerator Titanium. Note that developing such applications takes a lot of time.
Second option is to drop the desktop binding and make a web application with an advanced frontend UI made with one of JavaScript frameworks & friends (Ember, Angular... up to things like dhtmlx and alike widgets). Those can't use system components (like access some hardware), but they can provide nice services.
Take a look at pySide
I suggest using QtWebKit
And you can use PyInstaller if you want to hide the source code.
You can use TideSDK that can help you creating beautiful and unique desktop apps using your web development skills (HTML5 / CSS3 / JavaScript / Python or PHP or Ruby).
Website: http://www.tidesdk.org
Using Python in TideSDK: http://tidesdk.multipart.net/docs/user-dev/generated/#!/guide/using_python
Hope that helps! :)
Related
How can I create a simple frame in Kivy (Python for mobile), which will include a simple TextBox ?
Thanks guys
The biggest name I know of that uses (or used) wxPython is probably Dropbox:
How does Dropbox use Python on Windows and OS X?
This web page implies that NASA also uses wxPython:
https://modelingguru.nasa.gov/docs/DOC-2424/diff?secondVersionNumber=4
Google uses Python itself for all kinds of things and has been a big supporter of Python. They provide Python bindings to many of their product's APIs for example.
You might also check out the following for less well-known projects:
http://freecode.com/tags/wxpython
Whyteboard was getting popular for a while too.
There is significant movement away from desktop development to web and mobile development. For mobile, one of the best Python projects out there is Kivy. For the web, you have a lot of choices:
django
flask
pyramid
Plone / Zope
web2py
I have seen some pretty impressive desktop GUIs created using PyQt and IronPython, so I can't say that desktop GUI development is totally dead.
Maybe my question is stupid but I still want to ask. I am always wondering whether I can use Python, HTML and Css to develop a desktop software. I know there are alrealy several good GUI frameworks like Qt, Tk and etc. But the various sources of HTML and JS frameworks are still attractive to me. I don't mean a software which is just like a web application where there is a frontend and Python acts as a server side language either. I mean use Python like other GUI frameworks. I can create widgets built by HTML and Css.
Dose there any framework have this function? I know there is app.js for Javascript. Or what I think is wrong.
Look at pyjs.
What is pyjs?
pyjs is a Rich Internet Application (RIA) Development Platform for both Web and Desktop. With pyjs you can write your JavaScript-powered web applications entirely in Python.
CEFPython allows this by embedding the Chromium browser and providing python bindings to it:
https://code.google.com/p/cefpython/
~: python example.py
brings up:
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Recommended python library/framework for local web app?
I am looking for a lightweight framework/webserver that will make it easy to develop web interfaces for some demon processes or some application that should have ideally be an desktop application.
Some examples
To organize photo/music collections, move between folders, edit meta data of those etc,
A simple to-do list/ Money manager/ Documents manager etc,
A log/textFile viewer
A page showing the status of my git repositories
I prefer server side to be python. I don't want to run a full webserver like apache. As this is going to be used similar to a desktop app, I dont need any security features that will prevent me from accessing file system or running any shell commands or accessing internet etc.,
Any suggestions?
Check bottle.py
Most frameworks will have built-in development servers, so you can still use django or some other. But if you are looking for something lightweight to do some quick project, bottle.py can be great
Werkzeug is a good choice. It's a web toolkit more than a web framework. It's very mature, and is the basis of Flask, a popular microframework.
I've developed a website using vanilla Werkzeug and it was really intuitive. It has an explicit feel to it. None of the RoR-style autoload-controller and folder logic, just a bunch of classes and modules that are really well-documented and useful.
As well as cherry.py is a lightweight framework with full server.
http://www.cherrypy.org/
CherryPy allows developers to build web applications in much
the same way they would build any other object-oriented Python
program. This results in smaller source code developed in less time.
Any Python web microframework running on any wsgi compliant Python lightweight web server will do. There are already questions on both here.
I am basically a PHP guy. now moving towards python. I am starting to learn python.
How do I install it and start working it, and develop websites .
I got totally confused with the alternative implementations in the download section of the Python site. Can you tell me what "alternative implementations" means?.
I mean to say: I can create a .php file in my server and then access it from browser like http://example.com/index.php, so I was wondering whether I can do the same with python, like creating a .py file and accessing from browser http://example.com/index.py.
Just as a disclaimer, I interpret you saying "run Python in a browser" as "making a website with Python."
If you want to start writing web applications in Python, you can either use CGI or use one of its many web app frameworks. Python is not like PHP in the sense that you can't just embed it in HTML. Many of those frameworks come with development servers that you can use to test your web app (by looking at it in a browser).
A particularly good Python web framework is Django.
I really do recommend that you do the Python tutorial before you dive into any of those frameworks, though. Python is not only for writing web applications, so you'll have to get some fundamentals down first before any of that makes sense to you.
As for installing Python, I recommend you take the version you got with your OS if you use Mac or Linux, or installing the Python 2.7.1 32-bit binary from python.org if you use Windows. The alternative implementations include a Python that runs on the Java virtual machine and one that runs on the .NET Common Language Runtime, but for your purposes the reference implementation, CPython, should work fine.
Python by default is a general purpose scripting language and is not meant specifically for web application development (like PHP is primarily). So, you'll first need to download and install Python (choose the version that's appropriate for your OS) from www.python.org I'd recommend v2.7.1 but you can try out v3.2 if you'd like.
The other versions (IronPython, Jython, etc) are Python implementations on other platforms (.NET and JVM respectively), and in all likelihood you don't need to bother with them unless you really want to.
To start working with Python and create web applications you will also need to download and install a Python-based web framework. There are many of them, too many in fact to list here. However, there is a page on the Python Wiki that has a list of useful frameworks for web development.
You don't "run it from a browser". You don't run PHP from a browser, either.
The way to use Python for web development is to use a framework like Django or Pyramid.
Sage or CodeNode let you run Python in a browser.
You can get a limited Python experience by pointing your browser to http://shell.appspot.com/ . You will be running Python 2.5.2 on Google's site.
Being a web developer (php, symfony, doctrine) for 2 years now, I was recently asked by a friend to come up with a desktop solution. So I developed a project, installed a LAMP on his machine and he is mostly happy using it now. But I'm not. It just doesn't seem right to wait for a server response from a localhost. Obviously php isn't suited for desktop development. So, my question is: what language \ framework would you advice a php programmer if he was going to develop a desktop application (something that you can install, that has it's own gui, but utilizes the similar concepts of web apps: css, javascript, orm).
I would like to bring up Python as a possible answer to my question. Does anyone have an experience of developing a desktop app with Python, utilizing an ORM and(or) HTML-based GUI?
You should definitely use Python. It's great and really easy to get up and running and extremely powerful.
utilizing an ORM and(or) HTML-based GUI
Please don't do this. HTML has its purposes, and it's not in desktop apps. Please don't force your experience into new technologies.
You should look at the various python GUI frameworks. Tkinter, PyQt ( my preference), or GTK
It just doesn't seem right to wait for a server response from a localhost
Exactly! Did you profile your app, both on server side and in browser? There's no reason for a local web app to be slow, except if it is designed or implemented suboptimally. Same applies to a desktop app, which is generally harder to create.
So, fire up your Firebug, do explain plan to every database query your app issues, add whatever profiling your PHP settings allow, and see where the problem lies. Most probably, it's not in the choice of language.
Maybe Adobe AIR is something to take a look at? Check out their sample applications. If you don't like using a "proprietary" technology, check out HTML5 technologies like Web Storage and Web SQL (not in the HTML5) spec.) These technologies are completely client side (but can be extended to work over a network), so no need to wait for a server.
I've no clue how capable/easy to work with the Web SQL route is, but there are some decent AIR applications out there.
I've recently come across a project called Titanium. It's a platform for developing native desktop (and mobile) applications using web technology (html/css, javascript and server-side languages like python, ruby and PHP! That's exactly what I was looking for. However, I haven't found no decent documentation or examples, community is small, so it seems to be underdeveloped right now. It mostly aims at mobile development rather that desktop.
Apart from Titanium, I currently don't see a better way for a web developer to go.
Is the target platform windows? If so, consider C# with WPF. The UI is constructed using XAML which is very similar to HTML/CSS. C# uses the .NET framework, so while it is a much different programming language than PHP, the transition should not be too difficult.