How to remove the white strip between the sights



  • Somehow, two containers have a white strip.

    Who knows how to get rid of her?

    from PyQt5.Qt import *
    import sys
    

    class Window(QWidget):
    def init(self, parent=None):
    QWidget.init(self, parent)

        self.setMinimumSize(1000, 500)
    
        self.top_bar = QFrame()
        self.content = QFrame()
        self.left_bar = QFrame()
    
        self.vbox = QVBoxLayout()
        self.hbox = QHBoxLayout()
    
        self.hbox.setContentsMargins(0, 0, 0, 0)
    
        self.top_bar.setStyleSheet("background-color: rgb(45,45,45);")
        self.left_bar.setStyleSheet("background-color: rgb(45,45,45);")
        self.content.setStyleSheet("background-color: rgb(35,35,35);")
    
        self.hbox.addWidget(self.left_bar)
        self.top_bar.setMaximumHeight(40)
        self.left_bar.setMaximumWidth(80)
    
        self.hbox.setSpacing(0)
        self.hbox.addWidget(self.left_bar)
        self.vbox.addWidget(self.top_bar)
        self.vbox.addWidget(self.content)
        self.hbox.addLayout(self.vbox)
    
        self.setLayout(self.hbox)
    

    if name == "main":
    app = QApplication(sys.argv)
    window = Window()
    window.show()
    sys.exit(app.exec_())



  • Try that, but you better do what I wrote to you in the previous question.

    from PyQt5.Qt import *
    import sys
    

    class Window(QWidget):
    def init(self, parent=None):
    super().init(parent)

        self.setMinimumSize(1000, 500)
    
        self.top_bar = QFrame()
        self.content = QFrame()
        self.left_bar = QFrame()
    
        self.vbox = QVBoxLayout()
        
        self.hbox = QHBoxLayout() 
        self.setLayout(self.hbox)                                       # +++
    
        self.hbox.setContentsMargins(0, 0, 0, 0)
        
        self.top_bar.setStyleSheet("background-color: rgb(45,45,45);")
        self.left_bar.setStyleSheet("background-color: rgb(45,45,45);")
        self.content.setStyleSheet("background-color: rgb(35,35,35);")
    
        self.hbox.addWidget(self.left_bar)
        self.top_bar.setMaximumHeight(40)
        self.left_bar.setMaximumWidth(80)
    
        self.hbox.setSpacing(0)
        self.hbox.addWidget(self.left_bar)
        self.vbox.addWidget(self.top_bar)
        self.vbox.addWidget(self.content)
        self.hbox.addLayout(self.vbox)
    

    self.setLayout(self.hbox) # ---

    if name == "main":
    app = QApplication(sys.argv)
    window = Window()
    window.show()
    sys.exit(app.exec_())

    введите сюда описание изображения



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2