diff --git a/ex-statusbar-otherclass.py b/ex-statusbar-otherclass.py new file mode 100644 index 0000000..7cf6bf2 --- /dev/null +++ b/ex-statusbar-otherclass.py @@ -0,0 +1,49 @@ +import sys +# from PyQt5.QtWidgets import * +# from PyQt5.QtCore import * +# from PyQt5.QtGui import * +from PySide2.QtWidgets import * +from PySide2.QtGui import * +from PySide2.QtCore import * + +class MainWindow(QMainWindow): + def __init__(self,parent=None): + super(MainWindow, self).__init__(parent) + + self.win_widget = Example(self) + widget = QWidget() + layout = QVBoxLayout(widget) + layout.addWidget(self.win_widget) + self.setCentralWidget(widget) + self.statusBar().showMessage("İlk açılış mesajı") + +class Example(QWidget): + def __init__(self, parent=None): + super(Example, self).__init__(parent) + + self.myButton = QPushButton( "SA", self) + self.myButton2 = QPushButton("SA2", self) + + self.myButton2.clicked.connect(self.process) + + # create the layout area for tab widget + self.mylayout = QVBoxLayout() + self.mylayout.addWidget(self.myButton) + self.mylayout.addWidget(self.myButton2) + self.setLayout(self.mylayout) + + def process(self): + self.parent().parent().statusBar().showMessage("Buton tıklandığında mesaj") + + + +def main(): + try: + app = QApplication(sys.argv) + except: + app = QApplication.instance() + app.aboutToQuit.connect(app.deleteLater) + window = MainWindow() + window.show() + sys.exit(app.exec_()) +main() \ No newline at end of file diff --git a/ex-statusbar1.py b/ex-statusbar1.py new file mode 100644 index 0000000..6b00797 --- /dev/null +++ b/ex-statusbar1.py @@ -0,0 +1,41 @@ + +import sys +#from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton,QWidget +import sys +# from PyQt5.QtWidgets import * +# from PyQt5.QtCore import * +# from PyQt5.QtGui import * +from PySide2.QtWidgets import * +from PySide2.QtGui import * +from PySide2.QtCore import * +class Example(QMainWindow): + + def __init__(self): + super().__init__() + self.initUI() + + def initUI(self): + btn1 = QPushButton('One', self) + btn1.move(30, 50) + + btn2 = QPushButton('Two', self) + btn2.move(150, 50) + + btn1.clicked.connect(self.buttonClicked) + btn2.clicked.connect(self.buttonClicked) + + self.statusBar() + self.setGeometry(300, 300, 300, 150) + self.setWindowTitle('Window') + self.show() + + def buttonClicked(self): + sender = self.sender() + self.statusBar().showMessage(sender.text() + ' changed') + +if __name__ == '__main__': + app = QApplication(sys.argv) + ex = Example() + sys.exit(app.exec_()) + +