Skip to content

Instantly share code, notes, and snippets.

@hugoalmeidahh
Created May 29, 2018 22:11
Show Gist options
  • Save hugoalmeidahh/6a9c8aaba4e1b6ba3ad9c92dacc02e88 to your computer and use it in GitHub Desktop.
Save hugoalmeidahh/6a9c8aaba4e1b6ba3ad9c92dacc02e88 to your computer and use it in GitHub Desktop.
import sys
from importlib._bootstrap_external import _check_name
from PyQt5.QtWidgets import QMainWindow, QPushButton, QLabel, QMenu, qApp, QApplication, QWidget
from PyQt5.QtCore import QObject, Qt, pyqtSignal
from PyQt5.QtGui import QPainter, QFont, QColor, QPen
class MainWindow(QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__()
btn = QPushButton('Click me!', self)
btn.clicked.connect(self.onClick)
def onClick(self):
self.SW = SecondWindow()
self.SW.show()
class SecondWindow(QWidget):
def __init__(self):
super(SecondWindow, self).__init__()
lbl = QLabel('Second Window', self)
if __name__ == "__main__":
app = QApplication(sys.argv)
MW = MainWindow()
MW.show()
sys.exit(app.exec_())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment