This question already has an answer here:
PyQt : Linking buttons to functions in my program
(1 answer)
Closed 6 years ago.
So I have this GUI that has 2 empty text spots to fill and a "Run" button
I want to make it that the 2 empty text spots go to values in the program and the run button will run the python "Main" program ..
How can i do that ?
You need to have a look at the documentation for PyQt signals and slots. Normally, when you install PyQt you also install some great examples. Walk through the code and it will teach you a lot (search your filesystem for "qtdemo" or standarddialogs.py).
New-style signals and slots
Old-style signals and slots
Here's a snippet from standarddialogs.py:
self.saveFileNameButton = QPushButton("QFileDialog.get&SaveFileName()")
...
self.saveFileNameButton.clicked.connect(self.setSaveFileName)
...
def setSaveFileName(self):
Related
This question already has answers here:
In PyQt, what is the best way to share data between the main window and a thread
(1 answer)
Background thread with QThread in PyQt
(7 answers)
Example of the right way to use QThread in PyQt?
(3 answers)
Closed 3 months ago.
I wat to make an small python GUI in order to monitor the status of some services, to simplify it I want to see a green circle when the service is running and a red one when it is not
I have this piece of code to load a pixmap into a QLabel
self.m2w_state = QLabel(self)
running_icon = QPixmap('green.png')
self.m2w_state.setPixmap(running_icon)
self.m2w_state.resize(running_icon.width(), running_icon.height())
self.m2w_state.move(40, 50)
But now I'm trying to change this during execution from green to red. I tried in the same thread and the GUI got stuck, so I tried using a different thread, but an error appears saying that I cannot change the property from a different thread
How is the way to do that?
This question already has answers here:
Load whole *ui file in an frame/widget of another *.ui file
(1 answer)
PyQt: How to switch widgets in QStackedWidget
(5 answers)
Creating a custom widget in PyQT5
(2 answers)
Closed 3 years ago.
I am making a simple app and was wondering what the standard is for multiple windows when using Qt Designer and python.
I need to be able to have functional back and next buttons which will take me to the previous screen like in simple .exe installers.
I do not want to use the tab widget.
I have tried using the stacked widget but when using layouts on my first screen it gets inserted into the grid layout.
This question already has answers here:
Is there a GUI design app for the Tkinter / grid geometry? [closed]
(3 answers)
Closed 6 years ago.
I have tried using Tkinter but it is not so easy to create Attractive GUI application.Is there an application or online website where I can use Drag and Drop approach to create GUI Interface in python.or some other easy way Also reply with some Intutive references or tutorial if possible.
Pyqt seems like a good option here. It's a cross platform GUI framework that comes with qt designer, an applicatiom that let's you build GUIs by dragging and dropping widgets on a canvas.
Here's a basic tutorial you can follow. There's also a series of videos included with imformation on how to download and install pyqt
This question already has answers here:
PyQt - how to detect and close UI if it's already running?
(3 answers)
Closed 7 years ago.
I have created a pyqt4 app and I want to make it so only one instance (of QApplication) is allowed to run.
The program reads and writes audio files, and if more than 1 instance is running, Windows (linux is fine) throws errors that 2 programs are trying to access the same files. I see a lot of java and C apps that will display a simple dialog if the program is already running, I just want to know how to do this in pyqt4.
A little help?
This kind of programming pattern is called a "singleton" instance or a "singleton application".
Usually it is done with a global mutex or by locking a file early in the life of the program.
And when you program launches, if the file handle is already locked, then you exit.
Qt Solutions has it here: http://doc.qt.digia.com/solutions/4/qtsingleapplication/qtsingleapplication.html
https://qt.gitorious.org/qt-solutions/qt-solutions/source/841982ceec9d30a7ab7324979a0fd5c9c36fd121:qtsingleapplication
It would probably take a bit of work to get those global mutexes/locks to work in pyqt, since pyqt doesn't have the qt-solutions part in it yet as far as I could tell.
Here is an alternative that uses a cross platform python script:
Python: single instance of program
Hope that helps.
Thanks. I Used https://gitorious.org/qsingleapplication/qsingleapplication/source/ca13324b0f5bdfcaf4e379a78108f0bd85fed98a:qSingleApplication.py#L66 And Called QSingleApplication On My MainWindow And Works Fine
This question already has an answer here:
PyGObject and glade send window to the front
(1 answer)
Closed 8 years ago.
I am currently building an application with python 2.7 with Gtk3+.
I want to open a window on top of another window. If the second window is visible, the parent one should not be clickable.
So the behaviour should be the same like opening a dialog window.
What is the best way to achieve this?
You need to use the property window.set_transient_for(parent_window)
This post may help you if you are using glade.