pyqt5 | PyQt5 from riverbank

 by   baoboa C++ Version: Current License: GPL-3.0

kandi X-RAY | pyqt5 Summary

kandi X-RAY | pyqt5 Summary

pyqt5 is a C++ library typically used in User Interface, Qt5 applications. pyqt5 has no bugs, it has no vulnerabilities, it has a Strong Copyleft License and it has medium support. You can download it from GitHub.

SIP 4.19 source code in tarball directory. for pyqtdeploy use pip.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              pyqt5 has a medium active ecosystem.
              It has 1017 star(s) with 606 fork(s). There are 80 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 9 open issues and 42 have been closed. On average issues are closed in 37 days. There are 2 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of pyqt5 is current.

            kandi-Quality Quality

              pyqt5 has no bugs reported.

            kandi-Security Security

              pyqt5 has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              pyqt5 is licensed under the GPL-3.0 License. This license is Strong Copyleft.
              Strong Copyleft licenses enforce sharing, and you can use them when creating open source projects.

            kandi-Reuse Reuse

              pyqt5 releases are not available. You will need to build from source code and install.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of pyqt5
            Get all kandi verified functions for this library.

            pyqt5 Key Features

            No Key Features are available at this moment for pyqt5.

            pyqt5 Examples and Code Snippets

            No Code Snippets are available at this moment for pyqt5.

            Community Discussions

            QUESTION

            Columns not properly moving in QTableView (QAbstractTableModel) using beginMoveColumns?
            Asked 2021-Jun-15 at 20:13

            I am trying to use beginMoveColumns to move a single column over in a QTableView, but it doesn't work properly in my example below. The cell selections get shuffled and column widths don't move. Moving rows using the same logic seems to work correctly. What am I doing wrong?

            Video: https://www.screencast.com/t/5UJ0iByZCEE

            ...

            ANSWER

            Answered 2021-Jun-15 at 20:13

            Turns out it was a bug, I made a bug report here: https://bugreports.qt.io/browse/QTBUG-94503

            As a workaround I just clear cell selection on column move, and use this snippet to move column widths

            Source https://stackoverflow.com/questions/67941424

            QUESTION

            QtTest under PyQt5 fails when widgets-under-test have to be visible to work
            Asked 2021-Jun-15 at 17:01

            I've started to create UI tests for my PyQt5 widgets using QtTest but have run into the following difficulties:

            • In order to speed up things, some of my widgets only perform operations when visible. As it seems that QtTest runs with invisible widgets, the corresponding tests fail.

            • For the same reason, I cannot test program logic that makes a subwidget visible under certain conditions.

            Is there a way to make widgets visible during test? Is this good practice (e.g. w.r.t. CI test on GitHub) and is QtTest the way to go?

            I have tried to use pytest with pytest-qt without success as I couldn't find a proper introduction or tutorial and I do know "Test PyQt GUIs with QTest and unittest".

            Below you find a MWE consisting of a widget mwe_qt_widget.MyWidget with a combobox, a pushbutton and a label that gets updated by the other two subwidgets:

            ...

            ANSWER

            Answered 2021-Jun-15 at 17:01

            The problem is simple: QWidgets are hidden by default so isVisible() will return false, the solution is to invoke the show() method in init() to make it visible:

            Source https://stackoverflow.com/questions/67990408

            QUESTION

            How to get a return value in PyQt5?
            Asked 2021-Jun-15 at 16:49

            How to get the return value? Attach my code. My intention: Want to check the QListWidget and if it's empty, a message Box popup will raise and ask the option from the user. Problem: At the stage of beginning itself, a Message box popup will display, (I don't want it at the beginning stage), If the QListwidget is empty then the MessageBox popup will display as desired, and if we select "Yes" or " No" Button, Nothing will return/print in the first file. How to resolve?

            Main

            ...

            ANSWER

            Answered 2021-Jun-15 at 16:49

            In first it is not necessary to make the verification be done in a new class, it is also logical that you invoke func_create_newitem since as you point out that method must be invoked when the item was not found.

            Source https://stackoverflow.com/questions/67989712

            QUESTION

            How to add an image to QGraphicsScene so rectangle items can be located on it?
            Asked 2021-Jun-14 at 18:46

            I have a python code that I can add multiple rectangles on a QGraphicsScene.

            ...

            ANSWER

            Answered 2021-Jun-14 at 18:46

            There are several options:

            • setBackgroundBrush():

            Source https://stackoverflow.com/questions/67975449

            QUESTION

            PYQT5: some key presses not registering with keyPressEvent
            Asked 2021-Jun-14 at 17:19

            What my code is about: I'm currently working on a project to create an image browser for all the images I have in my PC. I have created a database of all the images, this app will give me the ability to search through the database to find, and view and cycle through the images.

            What my problem is: I'm trying to read left and right arrow key presses and connect them to a function that will change the shown image to the previous or next image in sequence. But for some reason the first two left-arrow presses don't register and none of the right-arrow presses register. Also, no other key presses are registering. My guess is that this is happening because the arrow keys are cycling through the widgets on screen. Need ideas on how I can fix this.

            ...

            ANSWER

            Answered 2021-Jun-14 at 17:19

            The main problem is that you're adding widgets that can get focus, while the "viewer" doesn't have a focus, nor it can accept one by keyboard/mouse if not programmatically.

            The result is that when the window is shown the first time, Qt will try to set the focus on the widget that can accept one within the central widget, but since there's none, any keyboard event is ignored. Whenever you try to use the arrow keys, then, Qt will use the "keyboard navigation" mode, and will find the first widget that can accept focus (the "search" button, if you go left), making the event accepted, and thus not propagated to the main window; going further, if you go left once more, the "tags" combo will get focused, again accepted and not propagated.

            A temporary workaround could be to ensure that the buttons and line edit only get focus by clicking (but buttons should probably not get focus at all):

            Source https://stackoverflow.com/questions/67971292

            QUESTION

            Videos are playing too fast using OpenCV and PyQT5
            Asked 2021-Jun-14 at 10:44

            My GUI is able to play videos automatically when selected in the QListWidget. However, instead of normal speed, the videos play very fast. I use 720p Mp4 videos as examples and are placed in a certain folder. I tried using cv2.CAP_PROP_FPS and cv2.CAP_PROP_BUFFERSIZE, but they are both not working. I am using pyqtSignal in the QThread and the convert_cv_qt function which I saw in other guides. How do I play the videos in normal speed / frame rate?

            ...

            ANSWER

            Answered 2021-Jun-14 at 10:44

            When you use VideoCapture with a file if you call "cap.read()" you will obtain the next frame on the video, regardless of its actual framerate. Hence, you should use a "msleep" every time you capture a frame:

            Source https://stackoverflow.com/questions/67021922

            QUESTION

            Create New file using File Dialog
            Asked 2021-Jun-13 at 20:15

            How can I create a new file using file dialog with pyqt5? This is my code so far, it prints out the correct path after I create the new file but it doesn't actually create it

            ...

            ANSWER

            Answered 2021-Jun-13 at 20:15
            def newFile(self):
                name = QtGui.QFileDialog.getSaveFileName(self, 'Save File')
                file = open(name,'w')
                text = ""
                file.write(text)
                file.close()
            

            Source https://stackoverflow.com/questions/67962203

            QUESTION

            how to automatically change the color of selected item in QListWidget
            Asked 2021-Jun-13 at 17:22

            I want to change the color of selected item in QListItem, and I find qss may be a solution. And the code is:

            ...

            ANSWER

            Answered 2021-Jun-13 at 17:22

            The problem is that you're setting a QWidget for the item, and since you're using a universal selector (with the wildcard), the result is that all QWidget will have that background color, including those added as item widgets for the list view.
            The color you used for the :selected pseudo is only valid for the item painted by the view, since the item widget has its own background set from the universal selector, that background won't be visible.

            The solution is to use a proper selector combination ensuring that the rule only matches children of the list view that have a usable selector, and set a transparent color for those widgets.

            A possibility is to set a custom property for the widgets that must be set before adding the widgets to the list (otherwise, you need to set the stylesheet after adding them, or request a style.unpolish()).

            Source https://stackoverflow.com/questions/67958360

            QUESTION

            Getting mouse position relative to image limits
            Asked 2021-Jun-12 at 19:05

            I display an image within a custom QLabel and get clicks on this label. I'm interested in clicks within the image only, and in a position expressed by a number between 0 and 1, 0 being the leftmost or topmost pixel and 1 the rightmost or bottommost pixel, regardless of the image actual size.

            I can't get the image rectangle to compute the position. When I call self.pixmap.rect(), width and height are the original image dimensions, not the dimensions of the image which was scaled to fit into the label.

            What am I doing doing wrong?

            ...

            ANSWER

            Answered 2021-Jun-12 at 17:16

            You have to use the QPixmap established in the QLabel that can be obtained through the pixmap() method. The problem is that you are obfuscating the access to that method since you have an attribute with a similar name. So the solution is to use pixmap() and rename the attribute pixmap.

            Source https://stackoverflow.com/questions/67949874

            QUESTION

            Python Unit Converter for Time using PyQt5 Module
            Asked 2021-Jun-12 at 03:00

            I have made a GUI application using PyQt5 module for my Unit converter for Time(Meaning converts the units of Time like seconds to milliseconds, minutes to milliseconds, etc) using a QtDesigner. But the only problem I am facing is that I do not know where and how to input the function of my application to make it work as a unit converter for Time. Below is the full code of my GUI application:

            ...

            ANSWER

            Answered 2021-Jun-12 at 03:00

            Qt uses a concept called "Signal/Slot mechanism".

            Every Qt object (QObject, which is inherited by all Qt widgets) is able to "emit" signals with a (possibly empty) amount of arguments, and that signal can be "registered" to slots, which are functions that will be called everytime that signal are emitted.[1]

            A typical case is a button (normally, a QPushButton), which has a clicked signal[2] that is emitted whenever the button is clicked, meaning that the mouse cursor is over the button both when the mouse button is pressed and then released.

            Every Qt widget has different signals depending on its purpose.
            For instance, the QLineEdit control has a textChanged (that is emitted whenever the text is changed, even programmatically) and textEdited (which is only emitted when the user actually types something in it).
            A QComboBox has the currentIndexChanged signal, emitted whenever the current item is changed (for instance, opening the popup and selecting a different item, or by using the mouse wheel over it).

            In the following code, I'll be connecting to "slots" (in this case, simple python functions) by completely ignoring the arguments of the related signals, but there are cases for which those arguments are actually needed.

            The idea is that whenever the user types something in any of the line edit fields, the related function tries to convert the typed value to a numeric one, and then, based on the current content of the comboboxes will do the proper conversion.

            Consider that:

            1. QLineEdit is not a suggested control for numeric input. A QSpinBox (for integers, otherwise a QDoubleSpinBox for floating points) is more suited for such situations; alternatively, setting a QIntValidator or QDoubleValidator on the line edit is possible.
            2. Using combobox.addItem() allows setting user data for each item along with the visible label; I'm using that "hidden" data by means of currentData() for multiplicators that are used for the conversion; this also means that you should remove any existing item for those comboboxes from the UI in Designer.
            3. Editing files generated by pyuic is considered bad practice (for a lot of reasons); I strongly suggest you to carefully read the official guidelines about using Designer, generate again the files from the UI and never touch them again (unless by overwriting with pyuic): those files should always be used as imports only. In the following code I'm assuming you've updated your UI (by removing the items in the first two combos) and converted them again to a file named unitConverterUi.py, which will NOT be the actual script you'll be running.
            4. Using fixed geometries (manually positioning and resizing widgets) is rarely a good idea. Remember that what you see on your screen is almost always never what others will see on theirs. Read more about layout managers and how to use them in Designer. User interfaces should be able to adapt to the screen and system settings of the user (what is called "responsive design" in modern website design).

            Source https://stackoverflow.com/questions/67944775

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install pyqt5

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/baoboa/pyqt5.git

          • CLI

            gh repo clone baoboa/pyqt5

          • sshUrl

            git@github.com:baoboa/pyqt5.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular C++ Libraries

            tensorflow

            by tensorflow

            electron

            by electron

            terminal

            by microsoft

            bitcoin

            by bitcoin

            opencv

            by opencv

            Try Top Libraries by baoboa

            pizza-lammps

            by baoboaPython

            serman

            by baoboaPython

            pythonCT

            by baoboaPython

            shinken.io

            by baoboaPython