text: # -*- coding: utf-8 -*-
  
  """
  ZetCode PyQt5 tutorial 
  
  In this example, we position two push
  buttons in the bottom-right corner 
  of the window. 
  
  Author: Jan Bodnar
  Website: zetcode.com 
  Last edited: August 2017
  """
  
  import sys
  from PyQt5.QtWidgets import (QWidget, QPushButton, 
      QHBoxLayout, QVBoxLayout, QApplication)
  
  
  class Example(QWidget):
  
      def __init__(self):
          super().__init__()
  
          self.initUI()
  
  
      def initUI(self):
  
          okButton = QPushButton("OK")
          cancelButton = QPushButton("Cancel")
  
          # 创建一个水平布局，增加两个按钮和弹性空间
          hbox = QHBoxLayout()
          hbox.addStretch(1)
          hbox.addWidget(okButton)
          hbox.addWidget(cancelButton)
  
          vbox = QVBoxLayout()
          vbox.addStretch(1)
          vbox.addLayout(hbox)
  
          self.setLayout(vbox)    
  
          self.setGeometry(300, 300, 300, 150)
          self.setWindowTitle('Buttons')    
          self.show()
  
  
  if __name__ == '__main__':
  
      app = QApplication(sys.argv)
      ex = Example()
      sys.exit(app.exec_())