Building a tree in a web app using Python - python

I'm new to Python and web development (although I have development experience with Client/Server apps .. a little rusty), and I need to build a Python web application that populates an interactive tree from a database (for my PG degree).
I've tried PyQT4 which contains a QTreeView/QTreeWidget but couldn't run this form as a web application. I've used QT Designer to build such form but couldn't make it run as a web app.
From Google search (over two weeks) I know that Django is the best framework to build a web app for Python, but it doesn't have an interactive tree viewer (am I right?).
I'm very confused at the moment and don't actually know where to go from here.
I'd appreciate your help in answering the following critical questions:
Can Django help in building such application? i.e. Does it support web tree view?
Can I use QTreeView from PyQt with Django? or even can I build a web application directly using PyQT and QT Designer?
If neither are suitable; Your suggestions are very much appreciated.

This isn't really a python or django issue: presentation on the web is done using (X)HTML, other types of XML (such as SVG), and javascript to automate the client side.
Go ahead and use django for your project, but understand that to do this, you will need to also get the hang of (at least) a javascript library for this task.

google django treeview for a few implementations. Alternativly use JavaScript. Django and Javascript play nicely and there are loads of JavaScript Treeview implementations.

Related

How to setup python flask web project with react on glitch?

I want to build a static web page based on python as server side and React for frontend on glitch online programming environment but unable to do .
I tried to implement by using CDN link but unable to use efficiently . Apart from this, I also wanted to use MATERIAL UI but according to there website it says
Using this approach in production is discouraged though - the client has to download the entire library, regardless of which components are actually used, affecting performance and bandwidth utilization.
Please elaborate steps to do the same.
Im sorry if that's too simple, but I managed to do it reading this article:
https://towardsdatascience.com/build-deploy-a-react-flask-app-47a89a5d17d9
I use the framework Flask, but if you are using Django the process must be similar.
But I recomend building a API with python and communicate with the front-end through the fecth API from javascript, or axios on react. You'll even be able to work on the frontend and backend in two different servers if you want.

Python: How to create a simple frame in Kivy?

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.

How to Build a Browser Interface for a Numpy/Opencv Based Python Application

I have an application written in Python using numpy and OpenCV. Currently I am using OpenCV's GUI functionality; however, I'm finding it has various issues and behaves differently across platforms. I would like to build a browser interface. The application includes a live video feed and its state is updated about once every 1/15th of a second-- I would need the browser display to update at this rate. What is a good tool to accomplish this? I have built small apps in EmberJS but I think that getting it to communicate with Python is too much overhead.
You probably want to connect your app to a Python web framework like Flask so that you can make a restful interface. You could then build a frontend app in Angular or Backbone that queries the server for every update.

How to use Python and HTML to build a desktop software?

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:

How can I use HTML + Javascript to build a python GUI? [closed]

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! :)

Categories