简体   繁体   中英

Layout in python with buttons in PYQT5

Im trying to get my windos better looking. To do this I wanted to use layout for the back button(B_btn). But I have no idea how to get it to apper in the bottom of the window. Hopefully this is not impossible but I am hard stuck..

class TestWindow(QWidget):
  def __init__(self, parent=None):
    super(TestWindow, self).__init__(parent)
    self.B_btn = QPushButton('Back', self)
    layout = QVBoxLayout()
    layout.addWidget(self.B_btn)
    self.setLayout(layout)

    self.SJ_btn = QPushButton('Single jump', self)
    self.SJ_btn.move(100, 100)
    self.SJ_btn.resize(180,60)

    self.SJI_btn = QPushButton('Info', self)
    self.SJI_btn.move(100, 160)
    self.SJI_btn.resize(180,20)

    self.MJ_btn=QPushButton("Multiple jump", self)
    self.MJ_btn.move(320,100)
    self.MJ_btn.resize(180,60)

    self.MJI_btn = QPushButton('Info', self)
    self.MJI_btn.move(320, 160)
    self.MJI_btn.resize(180,20)

    self.DT_btn = QPushButton('Drift test', self)
    self.DT_btn.move(100, 200)
    self.DT_btn.resize(180,60)

    self.DTI_btn = QPushButton('Info', self)
    self.DTI_btn.move(100, 260)
    self.DTI_btn.resize(180,20)

Okey now I did get it, its a stretcher i need. Thanks a lot!! If anyone know how to change the size of buttons in a layout I would be thankfull

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM