Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
i have just received a task to implement a software that paints over pictures (pretty much like microsoft paint )
i have no idea where to start or how to do that. do anyone have a good reference or idea for painting in qt or pyqt ?
this will be highly appreciated
thanks in advance
You'll be working with the QImage class, which represents bitmap images. It has methods for changing the colour at a given pixel using setPixel. There is am Image Viewer Example provided with Qt and PyQT should come with the same example in Python. However it uses a Qlabel to display the image so you may want to use a different widget, perhaps a custom QWidget subclass. You can start with that and add functionality to detect the mouse position in the , mouse clicks, etc and change the colours.
Check out Qt painting class QPainter:
https://doc.qt.io/archives/qt-4.7/qpainter.html
Have you looked at the scribble example included in PyQt? It does basic drawing, saving, loading, etc.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I want to disable and later re-enable a bunch of QPushButtons and QRadioButtons. Disabling them using button.setEnabled(False) works perfectly, the button outline and label are greyed out and it's not clickable anymore.
However, after doing button.setEnabled(True) later, the outline returns from grey to white, but the label stays grey.
Did I miss something or is this a bug in Qt?
Solution:
Turns out this problem is caused by me using multiple threads.
I solved the problem by switching from python threading to QThread and catching the started() / finished() signals of the new thread to disable/enable the UI elements.
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 5 years ago.
Improve this question
I searched so much but I couldn't find what I should use so I tried to use the built-in Tkinter but I can't find how to make what I want to make with it.
I want to have a text entry where user types something and my program makes some dynamic suggestions by opening a dropdown menu and user can choose the top option by pressing enter or they can click on one of the options or use up/down keys. and then that option will be added to a large text box under that single line textbox.
Can you recommend me any toolkit for python that I can make this GUI with? Also a link to a good tutorial for that toolkit would be much appreciated bc I'm new to python GUI.
Actually since this is very useful I'm sure there must be some snippet out there that would do this! But I can't find it yet!
Sorry if my question is a little too broad. But I'm so exhausted from searching to no avail. So I thought maybe some experienced people can easily help me out.
You can check out this module, which does exactly what you want (disclaimer: I am the author of that code).
Specifically, the code is not a tkinter.Entry widget, but a 'wrapper' (tk.Frame) around a tkinter.Entry and a tkinter.Listbox widget, the latter of which displays the results in an ordered list. If you want to redesign this behaviour yourself, I highly recommend using a similar approach rather than packing one widget below the other.
According to this link you have a lot of choices.
PyGTK
PyQt
wxPython
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'd like to create a tool in python that I can use to draw things on my screen. I found one tool that does what I want, Epic Pen, but it's only supported on Windows and it doesn't have all the functionality I need. I was hoping someone could suggest a library that would could help me out with this project. Most of my Python work has been in research, and I haven't built any GUI's so I'm not really familiar with any libraries that could help me out. I'm sure there's more than one library that fits the bill. Which do you recommend? Why?
A few requirements/notes
I'd like for the tool to be completely cross platform
(Linux/Mac/Windows)
I have to be able to draw things outside of a 'special' window. If I'm making a powerpoint presentation I'd like to be able to highlight or underline a key point. Or circle something on a picture etc.
I'd like to be able to get the position of the mouse on my screen and feed that back into the program.
Here's a link to a video showcasing the kind of tool I'd like to build
How To Highlight, Draw, Sketch Anything on Windows Screen Free Software
You will need to create a transparent widget that covers the screen so that you can draw on it. I don't know how each of the GUI toolkits does this, but I'm sure they all have the functionality necessary to grab the screen's size and create a window that can cover it. With wxPython, you would create a wx.Frame instance and call its SetTransparent method. You can see an example of that here:
http://www.blog.pythonlibrary.org/2008/04/14/doing-a-fade-in-with-wxpython/
The wxPython demo includes a drawing demo that you might also want to take a look at.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
How do I take a screenshot in PyQt?
I found QRubberBand Class, however I am unsure of how to do that in PyQt.
QtGui.QPixmap will do the trick for you, use it's grabWindow() method like this:
pixmap = QPixmap.grabWindow(QApplication.desktop().winId())
This will tak a screenshot of current desktop.
Now you can use QRubberband to select a specific area on the pixmap and use QPixmap.copy() to copy that selected area as another pixmap and finally use QPixmap.save() to save the selected area.
For more information look through Qt documentation here
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to use the Sharp LS027B7DH01 LCD display here: http://www.sharpmemorylcd.com/resources/LS027B7DH01_Spec.pdf
http://www.mouser.com/ProductDetail/Sharp-Microelectronics/LS027B7DH01/?qs=muFWWzTLGEIPdePNc1A/NQ==
I need to control it with a Raspberry Pi programmed in python 2.7. It is a 400x240 display controlled via SPI, but no controller chip part number is identified. There are only 4 commands to write to it, and each display line is written one at at time. I've not been able to find an existing driver to use with it (but honestly, I'm not sure I am searching for the right things)
I could write a driver from the ground up to do text and graphics and everything, but it seems like a lot of work, and surely something like this has to already exist...
Any assistance would be appreciated!
The best solution I have found is to create bitmaps of the entire screen area with other tools such as pybmp, PIL, etc and simply dump that image to the LCD for display.