Skip to content

Commit

Permalink
pyqt pyside statusbar
Browse files Browse the repository at this point in the history
Pyside ve Pyqt ile  Status Barı  Qwidget ile Kullanmak
  • Loading branch information
blalyasar authored Feb 15, 2021
1 parent 63dd85c commit 1f4c48a
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
49 changes: 49 additions & 0 deletions ex-statusbar-otherclass.py
Original file line number Diff line number Diff line change
@@ -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()
41 changes: 41 additions & 0 deletions ex-statusbar1.py
Original file line number Diff line number Diff line change
@@ -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_())


0 comments on commit 1f4c48a

Please sign in to comment.