import sys import PySide2 from PySide2 import QtGui, QtWidgets from PySide2.QtCore import Qt from PySide2.QtWidgets import * class App(QWidget): def __init__(self, parent=None): QWidget.__init__(self,parent) grid = QGridLayout(self) btnStart = QPushButton("Start") btnShtdw = QPushButton("Shutdown") btnStdBy = QPushButton("Stand By") grid.addWidget( btnStart, 1,1) grid.addWidget( btnShtdw, 2,2) grid.addWidget( btnStdBy, 3,1) self.setLayout(grid) self.setFixedSize(400,300) def location_on_the_screen(self): avlGeo = QDesktopWidget().availableGeometry() scrGeo = QDesktopWidget().screenGeometry() widget = self.geometry() x = avlGeo.width() - widget.width() y = 4 * avlGeo.height() - scrGeo.height() - widget.height() self.move(x,y) def appClose(self): self.close() def closeEvent(self, ev): resp= QMessageBox.question( self, "komunikat", "czy aby napewno zakonczyc dzialanie aplikacji?", QMessageBox.Yes | QMessageBox.No, QMessageBox.NO ) if resp == QMessageBox.Yes: ev.accept() else: ev.ignore() def read(): plik = "test.txt" with open(plik, "r") as reader: content = reader.readlines() print(content) if __name__=='__main__': app = QApplication(sys.argv) win = App() win.setWindowTitle('Room PC ctrl') win.show() sys.exit(app.exec_())