-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pyside ve Pyqt ile Status Barı Qwidget ile Kullanmak
- Loading branch information
Showing
2 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_()) | ||
|
||
|