I would like to create a "custom widget" in QtDesigner4 for matplotlib widgets.
I'm familiar with getting matplotlib widgets in QtDesigner3, and I have little problem manually coding the widget in Qt4. I'm not entirely sure how to do this the new way that QtDesigner handles custom widgets.
There appears to be some documentation, but I thought I'd ask if someone else has coded a solution before I attempt to do so myself.
I believe there is a matplotlib widget for qtdesigner4 (for windows) packaged with python(x,y).
I have never used it myself, but I found some discussion on how to use it here.
If you do have any luck with this, it would be great if you considered answering your own question with a detailed walkthrough!
HTH,
There is a solution in chapter 6 of "Matplotlib for Python Developers". Check out the book's supplemental code.
Related
I've been searching the internet far and wide for a tutorial on creating custom items for QListView using PySide. I find some usage using PyQt but I find them really strange to me. I would like to recreate using PySide the appearance of the items of the list shown in this link since I'm creating a desktop version of this web application. Any help/idea/sample code is greatly appreciated.
This question is pretty broad considering that you haven't shared any code. Nonetheless, let me point you to a good resource I found very useful getting into MVC programming in PyQt/PySide:
http://www.yasinuludag.com/blog/?p=98
He touches on ListView here and that may give you a better idea of how you can implement custom models and views.
He uses PySide from my recollection. Either ways, PyQt and PySide code are pretty much identical.
Another approach would be to not use QListView but use a QScrollArea and throw in the list items as widgets inside it. Each widget would be standard Qt widgets with a layout, sub widgets and styled as you need. Check this out for a similar scenario: PyQt: How can I create a custom scroll area?
Hope this helps.
I've been learning GTK3 on my own and I'm now stuck on Gtk.DrawingArea. As with most widgets and functions in GTK, there seems to be a lack of updated documentation and tutorials on this. For reference as to what I've found(hopefully this will help some other lost googlers), lazka's auto-generated documentation has been my best resource:
http://lazka.github.io/pgi-docs/Gtk-3.0/classes/index.html
However the drawing area page has no methods described.
http://lazka.github.io/pgi-docs/Gtk-3.0/classes/DrawingArea.html
This leads me to believe that I have a fundamental misunderstanding of GTK and this widget, but I can't find anything explaining how to work with it! The only tutorials I could find were these, but they are all for older versions;
1: http://www.pygtk.org/pygtk2tutorial/ch-DrawingArea.html
2: http://www.gtk.org/tutorial1.2/gtk_tut-23.html
3: http://www.pygtk.org/pygtk2tutorial/sec-DrawingMethods.html
3 is best of these tutorials, but I can't seem to get it to work in GTK3, and honestly its pretty advanced. Several things are also deprecated and the replacements seem to be pretty cryptic and are unclear how they work with DrawingArea:
http://lazka.github.io/pgi-docs/Gtk-3.0/classes/Widget.html#Gtk.Widget.set_style
The official tutorial doesn't have a section on it, and hasn't been significantly updated in a long time:
http://python-gtk-3-tutorial.readthedocs.org/en/latest/objects.html
https://github.com/sebp/PyGObject-Tutorial
My question now is whether someone could help me understand how to draw with Gtk.DrawingArea? Is there a gtk3 tutorial out there?
My goal at the moment is to automatically draw black points on a drawing area based on an algorithm's output, and display the results. I would show my code but I barely have anything.
You basically connect to the ::draw signal and draw in the handler using pycairo. And use queue_draw/queue_draw_area() if you want to redraw.
See http://zetcode.com/gfx/pycairo/basicdrawing/ for examples
I'm looking to design a (very) basic GUI for a battleship game.
As suggested in another question, I was going to use Tk's check buttons and coordinates and pass the value and so forth.
I'm having a tough time finding a decent start-up tutorial for Tkinter. I've tried Google and went through several results to little to no avail. Though I'm pretty experienced with Python, I've never done any GUI (other than lightly with Xcode). If anyone knows any good resources, I'd really appreciate it.
"Programming Python" by Mark Lutz has a chapter on GUI's.
The tkinter page on the Python wiki has links to tutorials as well.
tkdocs.com has a tutorial that covers tkinter (as well as using tk with Ruby, Perl and Tcl).
For what you need I suggest you look at the canvas widget
There are several resources: e.g. - http://www.techrepublic.com/article/tkinter-canvas-freeform-guis-in-python/6310698 or http://effbot.org/tkinterbook/canvas.htm
I have made a pygame physics simulation--'a projectile motion' but it lacks interactivity like accepting angle of launch,speed etc. I am wanting to add input boxes with increase decrease arrows but don't know how to go about it. Thanks for the help.
Maybe you can try PGU (Phil's pyGame Utilities).
In addition to other tools, it has a library for creating GUIs.
This PGU demo shows probably something similar to that you are looking for:
Try Some of these:
http://wiki.wxpython.org/IntegratingPyGame
http://www.pygame.org/project-Pygame+embedded+in+wxPython-1580-2788.html
Good luck!
I don't think trying to add wx-Elements is a very pygame way of implementing a GUI, a better (in sense of portable) way would be to use some all-in-python-GUI-extention for pygame. But the issue of GUI in pygame is anoying, since I could not find any library that offeres such a thing.
I know of two interesting approches, first there is Albow (a little bit of widgetry for pygame), which has a nice implementation of styles. The newest Version (which is not very new, I'm afraid) can be found at http://www.cosc.canterbury.ac.nz/greg.ewing/python/Albow/
Then there is OcempGUI http://ocemp.sourceforge.net/gui.html -- which has documentation and an some good concepts of event handling.
The sad thing is, both projects seem to be dead. I know of no other pygame-GUI that is worth looking at (correct my on that one, please!). For my own project I started to build something inspired by both of them (just don't expect that to ever become useable), since I'm not really content with either of the two. But they might by just the thing if you don't want to put too much time into it and want to have a good collection of GUI elements from labels and buttons up to file browsing dialogs or scrollable text fields.
Are there any good PyQt4 custom widgets like at Qt-Apps.org?
I would like to start making PyQt custom widgets but online resources that I find don't seem to be clear
For example, Trolltech's and Zetcode's don't seem to be related in any way at all.
Thanks for any input :)
There should be PyQt examples of all C++ Qt examples in your PyQt4 distribution. I have them here: /usr/share/doc/python-qt4-doc/examples. Theye are quite good for the start. When you understand them, it should also be fairly easy for you to port some C++ examples to PyQt code or turn C++ custom widgets to C++.
online resources about PyQt aren't really that rampant, so any information/projects would be welcomed. Don't hesitate to post links to your upcoming widgets or anything else.
I would be really glad to work on that with you as i'm learning more about pyqt as well.
Are you looking for tutorials on making custom PyQt widgets, or looking for a library of them?
I've been developing a library of reusable custom widgets if that's what you're looking for - at somepoint will be getting to the tutorials, but they aren't there yet.
Check out projexsoftware.com, specifically the ProjexUI framework:
http://dev.projexsoftware.com/projects/projexui
http://docs.projexsoftware.com/sdk-reference/projexui-sdk
In looking at it, I'll need to get some images up there...but there's a Calendar widget, Gantt Chart, View plugin system, Node view, Chart widgets, along with a number of extensions to the base Qt widget classes.
Also the easiest way to see the majority of the widgets is in the Qt Designer - so if you have it setup to work with PyQt plugins, wherever you install the projexui library you can add the /path/to/projexui/designer/build to your PYQTDESIGNERPATH and it'll load designer with our plugins.