K
K
Kurum2017-03-01 11:53:51
Python
Kurum, 2017-03-01 11:53:51

PyQ4 | The concept of launching multiple programs from the main window?

Python 3. PyQt4
There are several small QWidget window programs. It is supposed to quickly launch the desired program (or several) at a given time. If you launch from a folder with files, then each time a black console window will open additionally, which is not necessary at all.
It is most convenient to launch such programs from some main window with buttons. I also made such a thing on QWidget, everything works. However, I ran into problems:
1) The child window overlaps the parent window even if the parent window is active.
2) Only the parent window hangs on the toolbar of the operating system, there is no possibility to select a child window.
3) You can minimize the child window, but if you minimize the parent window, then all windows are minimized.
How best to resolve these issues?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zaswed, 2017-03-04
@Pyrym

do not make the opened window a child, that is, do not pass self

import sys
from PyQt5 import QtWidgets


class Widget(QtWidgets.QFrame):
    def __init__(self):
        super().__init__()
        self.btn = QtWidgets.QPushButton(self)
        self.btn.clicked.connect(self.show_wind)

    def show_wind(self):
        self.wind = QtWidgets.QFrame()
        self.wind.resize(200, 200)
        self.wind.show()


if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    main = Widget()
    main.show()
    sys.exit(app.exec_())
это для PyQt5 но принцип один

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question