0

How can i call other gui when click button? Here is run first gui so directly show me other gui not clicked button

--------------------------------------first gui:----------------------------

import sys
from PyQt5 import QtGui
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from other import Window


class Windows(QMainWindow):
def __init__(self):
    super().__init__()

    self.InitUI()

def InitUI(self):

    self.setWindowTitle(self.title)
    self.setGeometry(200, 200, 600, 500)

    self.button = QPushButton("Insert Data", self)
    self.button.setGeometry(100, 250, 100, 30)
    self.button.clicked.connect(self.Open)

    self.show()

def Open(self):
    self.notepad = Window()
    self.notepad.show()

App = QApplication(sys.argv)
window = Windows()
sys.exit(App.exec())

----------------------other gui:-----------------------

import sys
from PyQt5 import QtGui
from PyQt5.QtWidgets import QMainWindow, QApplication, QStatusBar


class Window(QMainWindow):
def __init__(self):
    super().__init__()

    self.InitUI()

def InitUI(self):

    self.statusBar().showMessage("This is a simple Status bar")

    self.setWindowTitle(self.title)
    self.setGeometry(200, 200, 600, 500)
    self.show()


App = QApplication(sys.argv)
window = Window()
sys.exit(App.exec())
eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Chuka B
  • 29
  • 1

2 Answers2

0

other gui.py:

import sys
from PyQt5 import QtGui
from PyQt5.QtWidgets import QMainWindow, QApplication, QStatusBar


class Window(QMainWindow):
   def __init__(self):
       super().__init__()

       self.InitUI()

   def InitUI(self):

       self.statusBar().showMessage("This is a simple Status bar")

       self.setWindowTitle('GUI')
       self.setGeometry(200, 200, 600, 500)

first gui doesn't need to be chnged

U13-Forward
  • 69,221
  • 14
  • 89
  • 114
0

Just replace your code by this:

from notepad import notepad
self._new_window = notepad()
self._new_window.showMaximized()
self.hide()  
pri
  • 104
  • 1
  • 8