Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I'm trying to decide which GUI framework to use to build my first Python GUI desktop app.
Important to mention that I recently started coding in Python and I do not have strong bases in C++.
For now my main focus for python is data parsing and data analytics. I plan on learning more advanced machine learning skills by end of year. The first GUI I'd like to build is for my data parsing though, it would be pretty basic with a couple buttons to popup file selection dialogs, select destination folders and load a file containing a set of parsing parameters.
Since I still consider myself a beginner, so I will pay attention to:
available documentation
active/supportive community
simplicity to get started with coding the UI
simplicity of sharing UI (although I plan on compiling to exe, so this may not be such a pb?)
For these reasons, I'm leaning towards using built in TKinter or wxPython which appears to give a neater result and which comes with many different widgets. PyQT seemed more complicated to learn to begin with
I would however really welcome a GUI designer function where I can build a simple enough UI using my mouse like in PyQT though. Does wxPython offer something similar?
I also read good things about PySide & Kivy any thoughts ?
Thanks!
I've recently come across the same issue and found another posting on here that may address what your looking for.
Displaying Pandas dataframe in tkinter
From personal experience tkinter is my preferred module for creating GUI's. There is plenty of documentation online and customizable widgets that addresses the functionality your looking for. Considering your experience in Python, I recommend this to start.
As for data parsing, I recommend using the pandas module as well. The pandas library provides several methods that are helpful when parsing files. I've used this to parse large csv files in the past.
The posting above has a link to a YouTube video playlist from "sentdx" who use tkinter to create a GUI to report bitcoin analytics. He also addresses how to convert tkinter to exe as well.
Best of Luck
You can try out Dash which is a Python-based framework which is predominantly used to create web applications that include intense data visualizations. For the purpose of data analytics and visualization this frame work could be better.
You can find out more information here.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have written an SEM (Scanning electron image)-image analysis program in Python which is capable of calculating all the microstructural properties in an SEM image e.g. Identification of different areas in the image 2) calculate the area of specific regions in microns, diameters, circularity, etc. The final results are in the form of a graph(area in microns vs cumulative frequency vs percentage contribution) plotted with the help of Matplotlibrary in Python. I want to give this program on a server where anyone can use it through an interface without looking at the code. I am confused that what should I use to do so? Will Django be a good choice for this? But I suspect Django cannot perform all the tasks (Not sure). I have also read about Jenkins servers. Please guide me which approach should I use to deploy this image analysis program for any user on a server. Thanks
Cool stuff!
If you want to make a server where other user can interact with your program using a user interface then yes Django (or even better Flask) will work.
A very basic structure for your program is to have one endpoint which will render a simple html home page with a form input for uploading a file. Once the file is uploaded, the form is shipped to your backend which will accept the file and give it as an input to your python function for SEM file analysis. The function could then generate a figure which the user will be able to download. That would however require setting up a database (which is usually simple with Django). So yes you can go either with Django or Flask and everything should fall into place.
However, be careful with research project aimed towards people that do not want to deal with scripting or code. I've made a few research project like this for brain imaging data (with a GUI and all) and all of these project ended up being a huge time sink. There will be updates to the analysis to do, bugs on the user interface to fix and cryptic compatibility issues. I've come to the realization that it is much better to have the minimal amount of user interface for a project like this and spend more time documenting how to make the code run on the command line using a well crafted README.md. This allows you to focus on what has a lot of value for your research and also helps other people learn valuable skills.
Anyway, that last paragraph was just my opinion! If you feel like setting up a full-blown website for this project go for it!
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I am looking for a PyQt5 tutorial. It is rather complicated to start GUI development with Python for the first time without a tutorial.
I only found some PyQt4 tutorials so far, and since something changed from Qt4 to Qt5, for example the fact SIGNAL and SLOT are no more supported in Qt5, it would be nice to have specific tutorials for PyQt5.
Can someone please provide a tutorial on how to start GUI development with PyQt5?
As my travels into the depths of PyQt5 continue, so shall I continue to update this answer with some of the shinier treasures I find.
That being said, I am now taking a "rough draft" stab at a quick intro to PyQt5. I will also provide links to helpful resources. I am new to this framework as well, and I will elaborate on what I believe to be a good strategy for using it, as I figure that strategy out. There are likely other good strategies, so if anyone has anything to add, then please leave a comment. This is very much a work in progress.
Strategy
I've learned much from the example code as suggested in the other answer, but something the examples don't help with is PyQt5's deep magic. Frameworks with a lot of magic in them (PyQt5, Django, SQLAlchemy, ...) are great because an enormous amount of drudgery is abstracted away from you. On the flip side, it is not always clear what the hell is going on, or what you're supposed to do about it.
Luckily, it seems we have options:
QtDesigner: For those days when your keyboard catches fire, there's a rockin' GUI-Builder called in the installation package. When you see the code this produces (perhaps only in the community version?), you'll see why this may not be the panacea it seems.
QML: Another candidate for panacea: declarative GUI building from formatted JSON. Yum.
Qt Quick: The framework for QML. By this point, it may seem tantalizingly easy, but don't get sucked in by this stuff just yet. It always seems to come down to learning it by hand.
The Model-View Framework(1): Model-View (not MVC) separates the code that deals with presentation/interaction from the code that manages the data, with the aim of providing modularity.
Coding in PyQt5 is greatly simplified by using the set of classes that implement the Model-View design pattern. Model-View is an evolution of Model-View-Controller (MVC), in which the Controller has been reunited with the View. They seem like strange bedfellows, but, most of the program's logic is dealing with either the user, or data: it seems to make a certain sense, at least at a stratospheric level.
From a bird's eye:
Architecture(s)
Model-View-Controller
This widely-used design pattern separates the application into 3 layers:
Model ~> Encapsulates the data. Notifies View and Controller of any changes to the underlying data. This causes updates to the display of output or available commands, respectively.
View ~> Displays the relevant output from the Model to the user.
Controller ~> Encapsulates user interaction, and notifies the Model and View of relevant events.
Model-View
The Graphics View Framework(1) ~> Represent everything (including embedded QWidgets, etc) inside a QGraphicsScene as a QGraphicsItem (or derivative thereof), including proxy classes for embedding widgets. The items are supposedly highly optimized, and integrating OpenGL support is a one-liner, which is nice.
This design pattern puts the Controller inside the View. This way, the view is capable of handling the entirety of the user's interaction. In concrete terms, these are the Signals and Slots mechanisms.
User Interaction Management
Callbacks
Signals and Slots
..... ** I'm sorry, but I must sign off now. I'll be back to continue to add to this. **
Practical Example(s)
Like, for instance, you can take a tree view from the itemviews/editabletreemodel example, then swap in a file system model (QFileSystemModel) from the itemviews/dirview example and you've got a full (working) view of your directory tree. Pretty snazzy.
So, you would take the code from the editabletreemodel example:
headers = ("Title", "Description")
file = QFile(':/default.txt')
file.open(QIODevice.ReadOnly)
model = TreeModel(headers, file.readAll())
file.close()
self.view.setModel(model)
...and swap in the model from dirview:
model = QFileSystemModel()
model.setRootPath('')
self.view.setModel(model)
...and it just works. Amazing.
The next step (in my case) (*I think) is implementing a custom model which I will then use several views concurrently, but I don't know if that kinda thing fits your use case.
Resources
Here are some gems I found on my travels. Hopefully they help you on yours.
This is a tutorial on Model-View for Qt5.(1) It is a very detailed document from the official Qt5 docs. A good deal of useful documentation can be found at the Qt5 site. Keep in mind, it's for Qt5 (the C++ library), but the difference is trivial to read through (and the PyQt5 official docs point there anyway).
This PDF contains a quick high-level to PyQt4's Model-View framework. Note that is it for PyQt4 (not PyQt5), but it is actually for Python (as opposed to C++), and I found it very quickly taught me a lot.
I am just starting to play with the Graphics View, and am finding this tutorial on the Graphics View Framework very helpful. This is the same View that is used in the qtdemo example code to generate some slick effects. I'll be updating this in a bit.
This is a complete list of all of the Qt5 Modules.
This is a complete list of all of the Qt5 Classes.
This is a complete list of all functions in the Qt5 API.
As katsh pointed out in another answer's comments, here is a link to the example code for PyQt5.2.1 on GitHub
Additionally, a copy of the example code comes packaged with your distribution and can be found at:
%PYTHON_HOME%\Lib\site-packages\PyQt5\examples
If you're using PyDev (Eclipse), you can run examples by simply right-clicking an example's main module file in PyDev Package Explorer or Navigator =:> Run As =:> Python Run
The best one, in my (not so) humble opinion, is:
%PYTHON_HOME%\Lib\site-packages\PyQt5\examples\qtdemo\qtdemo.py
Among my current projects, I'm in the process of reverse engineering this example. If you check it out, you'll see why. To be continued.. ;)
Enjoy!
Been looking for PyQt5 tutorials for some time? Look no further! You won't find many around the internet.
Not really tutorials, but pretty self-explanatory basic scripts under the following path:
/python/lib/site-packages/PyQt5/examples
you will find about 100 examples in 30 folders ranging from beginner to advanced, covering basic windows, menus, tabs, layouts, network, OpenGL, etc.
Have a look at http://www.thehackeruniversity.com/2014/01/23/pyqt5-beginner-tutorial/ This is a newbie friendly tutorial
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I'm looking for a python library/module that will allow me to create eye catching charts. The module must have/support the following
Windows Support
As I work mainly in windows(using Eclipse in Windows), this is crucial, a simple install .exe file (or adequate install instructions a must)
Work on Python 2.7
I've got Python 2.7.2 installed don't really want to go get some other thing.
Not require being on the web
I've looked at googlepychart, and it looks like you need to be on the web to make it work, I'm not on the world wide web, actually behind a VERY restrictive firewall.
Output should be viewable from HTML browser
While I cannot get onto the WorldWideWeb, I can see localhost, it would be great if the chart result be viewable in a browser.
Good documentation, at the very least some samples on how I can use the library.
If there are any suggestions on how I can create a web app using python that simply display/charts the data i pass in, such advice would be much appreciated
Plotly lets you make graphs using their online Python sandbox. Their gallery has some example scientific graphs with the Python scripts that generated them: https://plotly.com/python/. Here's a sample from the gallery:
matplotlib has become a mature and widely used graphing package.
As for your interaction with a web browser, you may have to use another package in conjunction. I suggest CherryPy because it is simple.
If you can do without using a browser, you can use one of Python Plotting Libraries. If you insist on using the browser, you would be better off using a javascript-based library for the view. I have used web2py web framework before along with protovis. But a simpler web framework like Bottle or CherryPy can also be used to pass the data to the view. Bottle has a Simple Template Engine (very similar to what I used in Web2py).
Developing in two languages (one of which is javascript) is a bit of a pain. You could use something like Pyjamas that translates python into javascript but I am not really sure if this would work out well, and I have no experience with it.
You may want to give details on the types of charts you want to make. Simple graphs are easy with sage and there are lots of options as compared to matlab. If you want more of a powerpoint chart, or picture you can insert into a word doc, then that's a little different.
If you can get something to create chart images, then you can hook it into a python web framework, such as django or pylons. That will allow you to set up a loopback server to host the page on your machine and view it on your machine. This is quite a bit more complex though.
My suggestion is to break your program down into pieces. It's like building a house out of lego brinks. You have an idea what you want it to look like, but the details determine everything. Break it down into the smallest pieces you can, and define larger pieces as groups of smaller pieces
The house is just several rooms. A room is just 4 walls, a floor and a ceiling. A wall is just several boards, and a board is 2x4. Once you break all the parts down, then you'll know not only what you need to make, but what you need to find for each piece.
You've got a good start with your list of requirements. That defines what you want your program to do. Now you need to work backwards to define the different parts. Don't get hung up on how they work, define the way they mesh.
For a simple python script to create a web server: see here. Note the section on dynamic content. By plugging that into a "black box" that produces your charts, you suddenly have a simple working setup. The charts section doesn't care how the user gets them, it just makes a chart and passes it out. The server doesn't care how the chart is made, it just serves it up.
This section of the sage manual has instructions for saving a plot after you create it.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I'm downloading Python 3.1.1 and that comes with the IDLE correct?
I'm also downloading QT for Windows which I'm told is a good GUI framework to work with Python.
What projects should I try to make in order to grasp some of the goodies Python brings to the table?
Thanks a bunch SO.
I highly recommend
http://www.diveintopython3.net
It assumes you already understand programming, and walks you through examples that demonstrate the unique abilities of Python.
Do the next project you intended to program with your prefered language with Python.
If you are new to python, why not start with some simpler command line projects? I know you said you are not new to development, but maybe you should spend some time with the core python stuff before tacking on a GUI framework. Just a suggestion.
Also, I would point out that Python 3+ code looks a bit different than a lot of the python 2.x code samples you will see around the internet. I have found Python 3 to be not the best in terms of backward compatibility. You might want to start out with a 2.x version of Python to get the most out of the plethora of Python tutorials on the internet, then move to Python 3 if you need it.
Write a simple Text Editor.
That was one of the projects i started when i first learned python. It gets you used to the GUI framework, file IO, many types, OOP, lots... It's something that you can grow over time as your confidence builds and it's cross platform so it's handy.
If python is your first dynamic lanugage you might want to play with some of it's dynamic aspects.
For example, using the getattr and setattr methods on objects, you could write a class that provides a fluent way of accessing elements from an XML document. Rather calling methods on an object with parameters like 'xml.getnode("a").getnode("b")' you could dynamically lookup the nodes as attributes and allow 'xml.a.b' instead. I thought this was very cool having come from static languages.
Note that this won't neccessarily give you a great feel for python in general (although you'll pick up the language as you go) but it will give you a taste of what is possible in dynamic languages.
PythonChallenge
Code Golf
Google Code Jam
These are good ways to practice learning Python.
Might I also suggest that you consider using a different IDE.
If you are interested in GUI programming, I would suggest looking into wxPython, PyWin32, easyGUI, TkInter (which is bundled with the Python distribution)
Python Challenge This is fun and interesting to learn Python programming.
While it is a matter of personal preference, I certainly wouldn't want to play around with a GUI framework when starting out -- I would want to get a feel for the language first by playing around with smaller snippets, such as those suggested on Code Golf. While getting your code to fit into the smallest number of bytes perhaps isn't the best way to learn good design, I think it's a good way to learn parts of the language. Certainly, just doing the tasks without necessarily trying to compact them down excessively could be helpful.
A project I wish someone would write: a friendly GUI that wraps around the scanner library and the PDF library, and lets the user easily scan and file documents.
It would have a toolbar with big buttons: "scan letter", "scan brochure", "scan photo". These would respectively choose high-resolution black-and-white, medium-resolution color, and high-resolution color.
The user would plop down the document and hit one of those buttons. Python would wake up the scanner and have it scan, and then would use Python Image Library or something to auto-detect the size of the actual scanned document and auto-crop down to minimal size.
For "scan photo" you would get a JPEG. For the others, you would get a PDF. And it would have an option where you could scan several pages and then select the scanned pages, and say "group" and it would make a single PDF out of them.
Other useful toolbar buttons would be: "Copy Letter", "Copy Brochure", "Copy Photo". These would scan and then immediately print on an appropriate output device (or just on the default output device for your first version).
If you want to go crazy, you could add an OCR function to try to recover searchable text from the scanned images, and put that in the PDF as tags or something.
Someday I will write this if nobody else does...
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed last year.
Improve this question
I'm developing a graphical application to present data (not a game but a real workhorse app). It needs to be cross platform, so I have chosen:
python
openGL (I need 3D, blending, textures etc)
pyopengl
wx/pywx - windowing, dialogs etc.
The last component - WX - raises the question. I can put together a very nice looking app (the prototypes look slick) - but when I need to interact with the user to ask questions, get input, I have to use WX. It makes the app look inconsistent to have traditional UI with traditional dialogs and combos and text entry on top of a full screen 3D app with blending, smooth motion, textures etc.
Has anyone developed a GUI using OpenGL and python? Can you share with me the toolkits and/or tricks you used? I need combos, text entry, buttons, radios, option buttons, tree view.
There are some toolkits out there, but they are either incomplete or old and unmaintained. A great example is pyUI (http://pyui.sourceforge.net/) - looks slick but untouched for years.
This is not an answer, more of a plea: Please don't do that.
Your reimplemented widgets will lack all sorts of functionality that users will miss. Will your text-entry boxes support drag'n'drop? Copy/paste? Right-to-left scripts? Drag-select? Double-click-select? Will all these mechanisms follow the native conventions of each platform you support?
With Wx your widgets might look inconsistant with the app, but at least they'll look consistant with the OS which is just as important. And more importantly, they'll do what users expect.
(edit) Three posts, and -3 points? Screw this den of karma-whores. Original poster: I have implemented a basic set of widgets in OpenGL (for a game UI) and it was an endless nightmare of a job.
In the latest releases of QT you can draw widgets into your OpenGL context, if you really would like to do something like that. Otherwise there is CEGui that is used in some game engines.
Implementing GUI Widgets yourself unless you want to edify yourself is a waste of your time, unless you would be satisfied with the most rudimentary of looks and functionality.
Python + Qt + OpenGL -
I surely believe any application can be written faster and better using python.
QT4 is cross-platform, beautifull, implements everything you need from widgets (acessibility, etc...), and...it integrates with OpenGL. That means, you can simply have a widget that is a viewport to openGL stuff you render in your code.
Another 3D capable solution that would cover most things, but not so nioce on user interface is to extend Blender3D with a python script. It has the 3d capabilities and rendering , you script it in python all of the same, and it would be cross platform - and you get higher level tools for woriking with the 3D things than openGL alone.
There are obvious drawbacks, mainly from the UI standpoint when compared with PyQT but it could be done.
You might want to look at Clutter, it looks pretty cool. I haven't used it yet but I intend to in an upcoming personal project.
Try Qt instead of wx.
QT is cross platform, and you can style things alot using CSS. It's extremely well documented and has excellent python bindings. In point of fact, I use the C++ documentation and not the PyQT documentation.
Both wx and QT do an excellent job of creating an application that matches the OS look and feel.
It is also possible to implment all the widgets yourself directly in openg, this slashdot post lists some of the sets available
http://ask.slashdot.org/askslashdot/02/12/24/1813219.shtml?tid=156
fox is probably the most developed but looks like windows on all platforms.
Blender is the only app I know of with a GUI written fully in OpenGL...
the only problem is it's in C++.
I'm a Python developer as well, but I'm just getting into using OGL
I honestly don't think there are any toolkits to develop a GUI in OGL...
the Blender developers are giving me runaround documentation instead of direct help...
but I'll let you know what I figure out ;)
EDIT:
here's a bit of documentation on PyOpenGL's functions:
http://pyopengl.sourceforge.net/documentation/manual/reference-GLUT.html
"cegui" is a good choise there is also a gui editor called "ceed" to generate the layout xml files. cegui also has python bindings and its well documented and used in many game engines
my friend.
I believe I have found your answer ;)
http://glinter.sourceforge.net/
I havn't yet tried it, but it seems quite promising.
(I'll edit this if it doesn't work)
EDIT:
eh...
it uses Tk, PMW, and WX...
(not quite what I want)
you can give the CVS download a try...
(there's no released packages, but the CVS runs)