I’m working on a script where when a user clicks on a button, a pop-up window will appear that contains a list. When the user doubleclicks on an item from that list, a label will populate on the original window with the selection. I’ve got most of the code working, but I’m having trouble on returning the selected value from
Tag: pyqt5
How to switch off selection when QTableWidget loses focus
I’m making a GUI in PyQt5 which has a QTableWidget. Is there some way to get rid of the gray selection of the previous selected cell after moving focus from this QTableWidget to another widget in the GUI? Answer You can use the palette to control the colour of the inactive selection. Setting it to transparent would seem the best
Best way of getting Qt pushbuttons Icons information in python?
Im developing a PyQt application which modifies buttons icons dynamically. The icons are created with QStyle, stored as class parameters and then put into the buttons with the setIcon() method. Since the icons are modified dynamically, i want an elegant way of checking what is the current button icon. The original Qt documentation mentions the setIcon() method but i couldnt
How to avoid the processing, if an unnecessary key is pressed (include or exclude user-defined, pre-defined keyss) in PyQt5?
How to avoid the processing, if an unnecessary key is pressed? For Example, In my code, I use Right Arrow and Left Arrowkey in keyPressEvent to move from one label to another label. and I assign keys F5, Alt+ A and ctrl+alt+p as shortcuts for labels. By default to print the First label “Accounts” is selected. Now if I press
Pyinstaller Error when try to create exe file
When i try to create the executable for my program using pyinstaller –onefile gui.py it gives me this error. pyqt5 and all the required packages are installed for the program but when i tried to create the executable it gives me this error what is wrong with the process Answer Finally i found a solution to fix the error. it
Is there a proper way to hatch QLabel
As stated in the title, I do want to know if there is a proper way to hatch the QLabel which in my case is has the Geometry of QRect as you can see in my code. I checked the documentation but I didn’t understand how I can hatch the QLabel. Here is an image of how it might the
Collect data from multiple files in a folder and save it as a variable
I want to collect the data from the first line in each .txt file, all the files are in the same folder. I then want to save it in the variable: (addPlayer) This will be needed to add items to a pqt5 list Folder directory: C:UsersHendreOneDriveDocumentsCourseWorkProjectPlayers Code: Answer I think that will help you
How to start a QApplication from shell without blocking it?
I have a simple Qt5 Application which can be installed as a pip package. The package has an entry point so i can start the application via a command prompt. The called function looks like the following: And the MainWindow (minimal working example): The problem is that now the command prompt IS the main application, so if i close the
How to change the default backend in matplotlib from ‘QtAgg’ to ‘Qt5Agg’ in Pycharm?
Qt5Agg is necessary to use the mayavi 3D visualization package. I have installed PyQt5 and mayavi using pip in a separate copied conda environment. The default backend then changes from TkAgg to QtAgg. This is a bit weird because in an earlier installation in a different PC the default changed directly to Qt5Agg. I always check the backend using the
How to keep QWidgets in QTreeWidget hidden during resize?
I have a simple UI with QWidgets within a QTreeWidget. Some of them need to be hidden. Every time the application is resized, all QWidgets become visible. Below is a minimal example to demonstrate the issue. How can I make sure the QWidgets stay hidden until setVisible(True) is called explicitly? pyqt version is 5.12.3 Answer Considering that this is caused