title: when I try to run my pyqt5 app the window's sizes changing
body: <p>I've designed an app ui using QT designer and convert it to .py file but when ever I try to run the app with python the window's size does not show as in the QT designer and some texts are cut.</p>
  <p>I've changed my python version and didn't work.</p>
  <p>I also tried Sublime instead of pycharm and faced the same issue. I've tried my code in another computer and  works correctly. Any Tip!</p>
  <p><strong>q64686336_main.py</strong></p>
  <pre><code>from PyQt5.QtGui import *
  from PyQt5.QtCore import *
  from PyQt5.QtWidgets import *
  import sys
  from PyQt5.uic import loadUiType
  import os
  from os import path
  
  
  ui, _ = loadUiType(path.join(path.dirname(__file__),&quot;q64686336.ui&quot;))
  
  
  class MainApp(QMainWindow, ui):
      def __init__(self , parent=None):
          super(MainApp , self).__init__(parent)
          QMainWindow.__init__(self)
          self.setupUi(self)
   
  
  def main():
      app = QApplication(sys.argv)
      window = MainApp()
      window.show()
      app.exec_()
  
  if __name__ == '__main__':
      main()
  </code></pre>
  <p><strong>q64686336.ui</strong></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;ui version=&quot;4.0&quot;&gt;
   &lt;class&gt;MainWindow&lt;/class&gt;
   &lt;widget class=&quot;QMainWindow&quot; name=&quot;MainWindow&quot;&gt;
    &lt;property name=&quot;geometry&quot;&gt;
     &lt;rect&gt;
      &lt;x&gt;0&lt;/x&gt;
      &lt;y&gt;0&lt;/y&gt;
      &lt;width&gt;496&lt;/width&gt;
      &lt;height&gt;246&lt;/height&gt;
     &lt;/rect&gt;
    &lt;/property&gt;
    &lt;property name=&quot;windowTitle&quot;&gt;
     &lt;string&gt;MainWindow&lt;/string&gt;
    &lt;/property&gt;
    &lt;property name=&quot;styleSheet&quot;&gt;
     &lt;string notr=&quot;true&quot;&gt;
  QWidget {
      background-color:rgb(0, 0, 0);
      color: rgb(240, 240, 240);
      border-color: rgb(58, 58, 58);
  }
  
  QPlainTextEdit {
      background-color:rgb(0, 0, 0);
      color: rgb(200, 200, 200);
      selection-background-color: rgb(255, 0, 0);
      selection-color: rgb(0, 0, 0);
  }
  
  QTabWidget::pane {
          border-top: 1px solid #000000;
  }
  
  QTabBar::tab {
      background-color:rgb(0, 0, 0);
      border-style: outset;
      border-width: 1px;
      border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255));
      border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255));
    border-bottom-color: rgb(58, 58, 58);
      border-bottom-width: 1px;
      border-top-width: 0px;
      border-style: solid;
      color: rgb(255, 0, 0);
      padding: 4px;
  }
  
  QTabBar::tab:selected, QTabBar::tab:hover {
     color: rgb(255, 255, 255);
     background-color:rgb(0, 0, 0);
     border-color:rgb(42, 42, 42);
     margin-left: 0px;
     margin-right: 0px;
     border-bottom-right-radius:4px;
     border-bottom-left-radius:4px;
  }
  
  QTabBar::tab:last:selected {
    background-color:rgb(0, 0, 0);
      border-color:rgb(42, 42, 42);
      margin-left: 0px;
      margin-right: 0px;
      border-bottom-right-radius:4px;
      border-bottom-left-radius:4px;
  }
  
  QTabBar::tab:!selected {
     margin-bottom: 4px;
     border-bottom-right-radius:4px;
     border-bottom-left-radius:4px;
  }
  
  QPushButton{
      border-style: outset;
      border-width: 2px;
      border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255));
      border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255));
      border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255));
      border-bottom-color: rgb(58, 58, 58);
      border-bottom-width: 1px;
      border-style: solid;
      color: rgb(255, 255, 255);
      padding: 6px;
      background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(77, 77, 77, 255), stop:1 rgba(97, 97, 97, 255));
  }
  
  QPushButton:hover{
      border-style: outset;
      border-width: 2px;
      border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255));
      border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255));
      border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255));
      border-bottom-color: rgb(115, 115, 115);
      border-bottom-width: 1px;
      border-style: solid;
      color: rgb(255, 255, 255);
      padding: 6px;
      background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(107, 107, 107, 255), stop:1 rgba(157, 157, 157, 255));
  }
  
  QPushButton:pressed{
      border-style: outset;
      border-width: 2px;
      border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(62, 62, 62, 255), stop:1 rgba(22, 22, 22, 255));
      border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255));
      border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255));
      border-bottom-color: rgb(58, 58, 58);
      border-bottom-width: 1px;
      border-style: solid;
      color: rgb(255, 255, 255);
      padding: 6px;
      background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(77, 77, 77, 255), stop:1 rgba(97, 97, 97, 255));
  }
  
  QPushButton:disabled{
      border-style: outset;
      border-width: 2px;
      border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255));
      border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255));
      border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255));
      border-bottom-color: rgb(58, 58, 58);
      border-bottom-width: 1px;
      border-style: solid;
      color: rgb(0, 0, 0);
      padding: 6px;
      background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(57, 57, 57, 255), stop:1 rgba(77, 77, 77, 255));
  }
  
  QLineEdit {
      border-width: 1px; border-radius: 4px;
      border-color: rgb(58, 58, 58);
      border-style: inset;
      padding: 0 8px;
      color: rgb(255, 255, 255);
      background:rgb(101, 101, 101);
      selection-background-color: rgb(187, 187, 187);
      selection-color: rgb(60, 63, 65);
  }
  
  QProgressBar {
      text-align: center;
      color: rgb(255, 255, 255);
      border-width: 1px; 
      border-radius: 10px;
      border-color: rgb(58, 58, 58);
      border-style: inset;
  }
  
  QProgressBar::chunk {
      background-color: qlineargradient(spread:pad, x1:0.5, y1:0.7, x2:0.5, y2:0.3, stop:0 rgb(255 , 0 , 0), stop:1 rgb(255 , 0 , 0));
      border-radius: 10px;
  }
  
  QMenuBar {
      background:rgb(0, 0, 0);
      color: rgb(255, 0, 0);
  }
  
  QMenuBar::item {
      spacing: 3px; 
      padding: 1px 4px;
      background: transparent;
  }
  
  QMenuBar::item:selected { 
      background:rgb(115, 115, 115);
  }
  
  QMenu {
      border-width: 2px; 
      border-radius: 10px;
      border-color: rgb(255, 0, 0);
      border-style: outset;
  }
  
  QMenu::item {
      spacing: 3px; 
      padding: 3px 15px;
  }
  
  QMenu::item:selected {
      spacing: 3px; 
      padding: 3px 15px;
      background:rgb(115, 115, 115);
      color:rgb(255, 255, 255);
      border-width: 1px; 
      border-radius: 10px;
      border-color: rgb(58, 58, 58);
      border-style: inset;
  }&lt;/string&gt;
    &lt;/property&gt;
    &lt;widget class=&quot;QWidget&quot; name=&quot;centralwidget&quot;&gt;
     &lt;widget class=&quot;QTabWidget&quot; name=&quot;tabWidget&quot;&gt;
      &lt;property name=&quot;geometry&quot;&gt;
       &lt;rect&gt;
        &lt;x&gt;0&lt;/x&gt;
        &lt;y&gt;0&lt;/y&gt;
        &lt;width&gt;481&lt;/width&gt;
        &lt;height&gt;221&lt;/height&gt;
       &lt;/rect&gt;
      &lt;/property&gt;
      &lt;property name=&quot;currentIndex&quot;&gt;
       &lt;number&gt;1&lt;/number&gt;
      &lt;/property&gt;
      &lt;widget class=&quot;QWidget&quot; name=&quot;tab_3&quot;&gt;
       &lt;attribute name=&quot;title&quot;&gt;
        &lt;string&gt;Tab 1&lt;/string&gt;
       &lt;/attribute&gt;
       &lt;widget class=&quot;QLabel&quot; name=&quot;label&quot;&gt;
        &lt;property name=&quot;geometry&quot;&gt;
         &lt;rect&gt;
          &lt;x&gt;20&lt;/x&gt;
          &lt;y&gt;20&lt;/y&gt;
          &lt;width&gt;47&lt;/width&gt;
          &lt;height&gt;21&lt;/height&gt;
         &lt;/rect&gt;
        &lt;/property&gt;
        &lt;property name=&quot;text&quot;&gt;
         &lt;string&gt;URL &lt;/string&gt;
        &lt;/property&gt;
       &lt;/widget&gt;
       &lt;widget class=&quot;QLabel&quot; name=&quot;label_2&quot;&gt;
        &lt;property name=&quot;geometry&quot;&gt;
         &lt;rect&gt;
          &lt;x&gt;20&lt;/x&gt;
          &lt;y&gt;63&lt;/y&gt;
          &lt;width&gt;47&lt;/width&gt;
          &lt;height&gt;21&lt;/height&gt;
         &lt;/rect&gt;
        &lt;/property&gt;
        &lt;property name=&quot;text&quot;&gt;
         &lt;string&gt;Location&lt;/string&gt;
        &lt;/property&gt;
       &lt;/widget&gt;
       &lt;widget class=&quot;QPushButton&quot; name=&quot;pushButton&quot;&gt;
        &lt;property name=&quot;geometry&quot;&gt;
         &lt;rect&gt;
          &lt;x&gt;340&lt;/x&gt;
          &lt;y&gt;60&lt;/y&gt;
          &lt;width&gt;71&lt;/width&gt;
          &lt;height&gt;25&lt;/height&gt;
         &lt;/rect&gt;
        &lt;/property&gt;
        &lt;property name=&quot;text&quot;&gt;
         &lt;string&gt;Browse&lt;/string&gt;
        &lt;/property&gt;
       &lt;/widget&gt;
       &lt;widget class=&quot;QLineEdit&quot; name=&quot;lineEdit&quot;&gt;
        &lt;property name=&quot;geometry&quot;&gt;
         &lt;rect&gt;
          &lt;x&gt;90&lt;/x&gt;
          &lt;y&gt;20&lt;/y&gt;
          &lt;width&gt;321&lt;/width&gt;
          &lt;height&gt;25&lt;/height&gt;
         &lt;/rect&gt;
        &lt;/property&gt;
       &lt;/widget&gt;
       &lt;widget class=&quot;QProgressBar&quot; name=&quot;progressBar&quot;&gt;
        &lt;property name=&quot;geometry&quot;&gt;
         &lt;rect&gt;
          &lt;x&gt;103&lt;/x&gt;
          &lt;y&gt;100&lt;/y&gt;
          &lt;width&gt;291&lt;/width&gt;
          &lt;height&gt;25&lt;/height&gt;
         &lt;/rect&gt;
        &lt;/property&gt;
        &lt;property name=&quot;value&quot;&gt;
         &lt;number&gt;24&lt;/number&gt;
        &lt;/property&gt;
       &lt;/widget&gt;
       &lt;widget class=&quot;QLineEdit&quot; name=&quot;lineEdit_2&quot;&gt;
        &lt;property name=&quot;geometry&quot;&gt;
         &lt;rect&gt;
          &lt;x&gt;90&lt;/x&gt;
          &lt;y&gt;60&lt;/y&gt;
          &lt;width&gt;251&lt;/width&gt;
          &lt;height&gt;25&lt;/height&gt;
         &lt;/rect&gt;
        &lt;/property&gt;
       &lt;/widget&gt;
       &lt;widget class=&quot;QPushButton&quot; name=&quot;pushButton_2&quot;&gt;
        &lt;property name=&quot;geometry&quot;&gt;
         &lt;rect&gt;
          &lt;x&gt;146&lt;/x&gt;
          &lt;y&gt;140&lt;/y&gt;
          &lt;width&gt;211&lt;/width&gt;
          &lt;height&gt;25&lt;/height&gt;
         &lt;/rect&gt;
        &lt;/property&gt;
        &lt;property name=&quot;text&quot;&gt;
         &lt;string&gt;Download&lt;/string&gt;
        &lt;/property&gt;
       &lt;/widget&gt;
      &lt;/widget&gt;
      &lt;widget class=&quot;QWidget&quot; name=&quot;tab_2&quot;&gt;
       &lt;attribute name=&quot;title&quot;&gt;
        &lt;string&gt;Tab 2&lt;/string&gt;
       &lt;/attribute&gt;
       &lt;widget class=&quot;QLabel&quot; name=&quot;label_3&quot;&gt;
        &lt;property name=&quot;geometry&quot;&gt;
         &lt;rect&gt;
          &lt;x&gt;20&lt;/x&gt;
          &lt;y&gt;63&lt;/y&gt;
          &lt;width&gt;47&lt;/width&gt;
          &lt;height&gt;21&lt;/height&gt;
         &lt;/rect&gt;
        &lt;/property&gt;
        &lt;property name=&quot;text&quot;&gt;
         &lt;string&gt;Location&lt;/string&gt;
        &lt;/property&gt;
       &lt;/widget&gt;
       &lt;widget class=&quot;QProgressBar&quot; name=&quot;progressBar_2&quot;&gt;
        &lt;property name=&quot;geometry&quot;&gt;
         &lt;rect&gt;
          &lt;x&gt;103&lt;/x&gt;
          &lt;y&gt;100&lt;/y&gt;
          &lt;width&gt;291&lt;/width&gt;
          &lt;height&gt;25&lt;/height&gt;
         &lt;/rect&gt;
        &lt;/property&gt;
        &lt;property name=&quot;value&quot;&gt;
         &lt;number&gt;24&lt;/number&gt;
        &lt;/property&gt;
       &lt;/widget&gt;
       &lt;widget class=&quot;QLabel&quot; name=&quot;label_4&quot;&gt;
        &lt;property name=&quot;geometry&quot;&gt;
         &lt;rect&gt;
          &lt;x&gt;20&lt;/x&gt;
          &lt;y&gt;20&lt;/y&gt;
          &lt;width&gt;47&lt;/width&gt;
          &lt;height&gt;21&lt;/height&gt;
         &lt;/rect&gt;
        &lt;/property&gt;
        &lt;property name=&quot;text&quot;&gt;
         &lt;string&gt;URL &lt;/string&gt;
        &lt;/property&gt;
       &lt;/widget&gt;
       &lt;widget class=&quot;QPushButton&quot; name=&quot;pushButton_3&quot;&gt;
        &lt;property name=&quot;geometry&quot;&gt;
         &lt;rect&gt;
          &lt;x&gt;146&lt;/x&gt;
          &lt;y&gt;140&lt;/y&gt;
          &lt;width&gt;211&lt;/width&gt;
          &lt;height&gt;25&lt;/height&gt;
         &lt;/rect&gt;
        &lt;/property&gt;
        &lt;property name=&quot;text&quot;&gt;
         &lt;string&gt;Download&lt;/string&gt;
        &lt;/property&gt;
       &lt;/widget&gt;
       &lt;widget class=&quot;QLineEdit&quot; name=&quot;lineEdit_3&quot;&gt;
        &lt;property name=&quot;geometry&quot;&gt;
         &lt;rect&gt;
          &lt;x&gt;90&lt;/x&gt;
          &lt;y&gt;20&lt;/y&gt;
          &lt;width&gt;321&lt;/width&gt;
          &lt;height&gt;25&lt;/height&gt;
         &lt;/rect&gt;
        &lt;/property&gt;
       &lt;/widget&gt;
       &lt;widget class=&quot;QLineEdit&quot; name=&quot;lineEdit_4&quot;&gt;
        &lt;property name=&quot;geometry&quot;&gt;
         &lt;rect&gt;
          &lt;x&gt;90&lt;/x&gt;
          &lt;y&gt;60&lt;/y&gt;
          &lt;width&gt;251&lt;/width&gt;
          &lt;height&gt;25&lt;/height&gt;
         &lt;/rect&gt;
        &lt;/property&gt;
       &lt;/widget&gt;
       &lt;widget class=&quot;QPushButton&quot; name=&quot;pushButton_4&quot;&gt;
        &lt;property name=&quot;geometry&quot;&gt;
         &lt;rect&gt;
          &lt;x&gt;340&lt;/x&gt;
          &lt;y&gt;60&lt;/y&gt;
          &lt;width&gt;71&lt;/width&gt;
          &lt;height&gt;25&lt;/height&gt;
         &lt;/rect&gt;
        &lt;/property&gt;
        &lt;property name=&quot;text&quot;&gt;
         &lt;string&gt;Browse&lt;/string&gt;
        &lt;/property&gt;
       &lt;/widget&gt;
      &lt;/widget&gt;
     &lt;/widget&gt;
    &lt;/widget&gt;
    &lt;widget class=&quot;QMenuBar&quot; name=&quot;menubar&quot;&gt;
     &lt;property name=&quot;geometry&quot;&gt;
      &lt;rect&gt;
       &lt;x&gt;0&lt;/x&gt;
       &lt;y&gt;0&lt;/y&gt;
       &lt;width&gt;496&lt;/width&gt;
       &lt;height&gt;19&lt;/height&gt;
      &lt;/rect&gt;
     &lt;/property&gt;
    &lt;/widget&gt;
    &lt;widget class=&quot;QStatusBar&quot; name=&quot;statusbar&quot;/&gt;
   &lt;/widget&gt;
   &lt;resources/&gt;
   &lt;connections/&gt;
  &lt;/ui&gt;
  </code></pre>
  <p><a href="https://i.stack.imgur.com/LrO7k.png" rel="nofollow noreferrer">click here to see how it appears on the preview mode (right side) and how it apears when I run the script (left side) </a></p>
  <p><a href="https://i.stack.imgur.com/i22x3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/i22x3.png" alt="enter image description here" /></a></p>