-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathex-statusbar-otherclass.py
49 lines (39 loc) · 1.39 KB
/
ex-statusbar-otherclass.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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()