Python Forum
Pop up the Python shell after clicking a window
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pop up the Python shell after clicking a window
#1
My Code pulls up a menu, you click on the button and it pulls up another menu. That menu has a button you can click that will print some words.
The problem is, it pulls up in the cmd prompt. Is it possible to have it pull up the cmd.exe when the user clicks the button so they don't have to click on the cmd.exe?

Here's the first menu-
from PyQt5 import QtCore, QtGui, QtWidgets
from Test2 import *

class Ui_MainWindow(object):
    def ipDombtn(self):
        self.window=QtWidgets.QMainWindow()
        self.ui=Ui_MainWindow1()
        self.ui.setup(self.window)
        self.window.show()


    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(412, 440)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
        self.verticalLayout.setObjectName("verticalLayout")



        self.pushButton = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton.setObjectName("pushButton")
        self.verticalLayout.addWidget(self.pushButton)
        self.pushButton.clicked.connect(self.ipDombtn)


        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 412, 31))
        self.menubar.setObjectName("menubar")

        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)


        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)


    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.pushButton.setText(_translate("MainWindow", "Investigation"))


if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())
Here's the second menu-
from PyQt5 import QtCore, QtGui, QtWidgets

class Ui_MainWindow1(object):

    def exIpDomInv_clicked(self):
        print("You clicked a button...")





    def setup(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(412, 440)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
        self.verticalLayout.setObjectName("verticalLayout")


        self.exIpDomInv = QtWidgets.QPushButton(self.centralwidget)
        self.exIpDomInv.setObjectName("exIpDomInv")
        self.verticalLayout.addWidget(self.exIpDomInv)


        MainWindow.setCentralWidget(self.centralwidget)
        self.Menu = QtWidgets.QMenuBar(MainWindow)
        self.Menu.setGeometry(QtCore.QRect(0, 0, 412, 31))
        self.Menu.setObjectName("Menu")

        MainWindow.setMenuBar(self.Menu)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")

        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

        self.exIpDomInv.clicked.connect(self.exIpDomInv_clicked)



    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "Investigation"))
        MainWindow.setAccessibleName(_translate("MainWindow", "InvestigationMenu"))
        self.exIpDomInv.setText(_translate("MainWindow", "External IP/ Domain Investigation"))



if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    MainWindow1 = QtWidgets.QMainWindow()
    ui2 = Ui_MainWindow1()
    ui2.setup(MainWindow1)
    MainWindow1.show()
    sys.exit(app.exec_())
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is there a way to call and focus any popup window outside of the main window app? Valjean 6 1,610 Oct-02-2023, 04:11 PM
Last Post: deanhystad
  Help creating shell scrip for python file marciokoko 10 1,256 Sep-16-2023, 09:46 PM
Last Post: snippsat
  Launch Python IDLE Shell from terminal Pavel_47 5 1,143 Feb-17-2023, 02:53 PM
Last Post: Pavel_47
  Pyspark Window: perform sum over a window with specific conditions Shena76 0 1,131 Jun-13-2022, 08:59 AM
Last Post: Shena76
Sad Selenium: can't open a new window after clicking a button and I don't know why noahverner1995 0 1,936 Jan-22-2022, 09:55 AM
Last Post: noahverner1995
  batch file for running python scipt in Windows shell MaartenRo 2 1,825 Jan-21-2022, 02:36 PM
Last Post: MaartenRo
  Clicking Every Page and Attachment on Website shoulddt 1 1,699 Jul-09-2021, 01:08 PM
Last Post: snippsat
  How to make a Python program run in a dos shell (cmd) Pedroski55 2 2,256 Nov-09-2020, 10:17 AM
Last Post: DeaD_EyE
Bug Python Shell 3.9.0 - Issue with indentation Earis 17 6,430 Oct-31-2020, 07:00 AM
Last Post: Earis
  Python "Terminal" vs "Shell" SectionProperties 2 2,617 Apr-10-2020, 08:36 AM
Last Post: SectionProperties

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020