0

I created a GUI where if you click to a button than it will open a python file. But after the click I want to just see the console. How can I hide the GUI or close without closing the console part?

(Windows 10, Python 3.8.5)

  • This question has already been answered. https://stackoverflow.com/questions/4872523/how-do-i-hide-the-console-window-for-my-app – max wiklund Nov 01 '20 at 19:14
  • No, because I want the opposite. I want to hide the GUI. (And not always, just if I click to a button). – Bakonyi Máté Nov 01 '20 at 19:27
  • Your question is a bit confusing. While you can hide the GUI, what is the use of showing the consolle that, at that time, will not be interactive, since the program is still running? – musicamante Nov 01 '20 at 21:59
  • Because I wanted to build a GUI for my consol python programs. So with buttons, I could reach them. But it will open in the console part of the program. So I wanted to hide the GUI at a point in the program (because it's annoying when I just need the console part of it). Is it still confusing? – Bakonyi Máté Nov 02 '20 at 17:57

1 Answers1

0

You can hide it.

from PyQt5 import QtWidgets


if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    win = QtWidgets.QWidget()
    win.show()
    win.setVisible(False)
    sys.exit(app.exec_())
max wiklund
  • 103
  • 1
  • 5
  • Nice, it worked. Thanks. And another question. It's all good but it could be better if first (when I see the GUI, the console won't pop up. Could I do it somehow? (I know that .pwy won't show the console, but as you know I just want it at the beginning. – Bakonyi Máté Nov 02 '20 at 18:51