QtDesigner переупорядочивает радиокнопки при сохранении в файл пользовательского интерфейса

Я использую QtDesigner для создания uifile для приложения PyQT5. У меня есть коллекция QRadioButtons в группе кнопок. Проблема, с которой я сталкиваюсь, заключается в том, что при сохранении в uifile порядок сохраняемых кнопок влияет на макет. Когда я печатаю QRadioButton.geometry() каждой кнопки, значения верны, но они не отображаются таким образом в окончательном графическом интерфейсе, если я не отредактирую uifile и не изменю порядок виджетов.

Вот желаемый макет:

      rb6 rb7 rb8
      rb3 rb4 rb5  rb9
      rb0 rb1 rb2

Поиск в Notepad++ по запросу "QRadioButton" показывает порядок сохранения кнопок:

Search "RadioButton" (10 hits in 1 file)
  E:\FileNamingWidget.ui (10 hits)
    Line 543:    <widget class="QRadioButton" name="Rb8">
    Line 565:    <widget class="QRadioButton" name="Rb0">
    Line 590:    <widget class="QRadioButton" name="Rb9">
    Line 618:    <widget class="QRadioButton" name="Rb7">
    Line 640:    <widget class="QRadioButton" name="Rb3">
    Line 662:    <widget class="QRadioButton" name="Rb4">
    Line 687:    <widget class="QRadioButton" name="Rb5">
    Line 709:    <widget class="QRadioButton" name="Rb2">
    Line 731:    <widget class="QRadioButton" name="Rb6">
    Line 753:    <widget class="QRadioButton" name="Rb1">

Затем радиокнопки располагаются следующим образом:

     rb8 rb3 rb0
     rb4 rb5 rb6 rb2
     rb1 rb9 rb7

Почему? Помимо редактирования uifile вручную, прежде чем я загружу его в свою программу Python с помощью uic.loadUI(), как я могу это исправить?

Спасибо за любую помощь.

Вот виджеты QRadioButton из файла uifile в том порядке, в котором они были сохранены:

   <widget class="QRadioButton" name="Rb8">
    <property name="geometry">
     <rect>
      <x>107</x>
      <y>121</y>
      <width>16</width>
      <height>13</height>
     </rect>
    </property>
    <property name="toolTip">
     <string>Right Rear</string>
    </property>
    <property name="text">
     <string/>
    </property>
    <property name="autoExclusive">
     <bool>false</bool>
    </property>
    <attribute name="buttonGroup">
     <string notr="true">buttonGroup</string>
    </attribute>
   </widget>
   <widget class="QRadioButton" name="Rb0">
    <property name="enabled">
     <bool>true</bool>
    </property>
    <property name="geometry">
     <rect>
      <x>62</x>
      <y>159</y>
      <width>16</width>
      <height>13</height>
     </rect>
    </property>
    <property name="toolTip">
     <string>Left Front</string>
    </property>
    <property name="text">
     <string/>
    </property>
    <property name="autoExclusive">
     <bool>false</bool>
    </property>
    <attribute name="buttonGroup">
     <string notr="true">buttonGroup</string>
    </attribute>
   </widget>
   <widget class="QRadioButton" name="Rb9">
    <property name="geometry">
     <rect>
      <x>130</x>
      <y>140</y>
      <width>13</width>
      <height>13</height>
     </rect>
    </property>
    <property name="toolTip">
     <string>Multi Aspect</string>
    </property>
    <property name="text">
     <string/>
    </property>
    <property name="shortcut">
     <string/>
    </property>
    <property name="checked">
     <bool>false</bool>
    </property>
    <property name="autoExclusive">
     <bool>false</bool>
    </property>
    <attribute name="buttonGroup">
     <string notr="true">buttonGroup</string>
    </attribute>
   </widget>
   <widget class="QRadioButton" name="Rb7">
    <property name="geometry">
     <rect>
      <x>84</x>
      <y>121</y>
      <width>17</width>
      <height>13</height>
     </rect>
    </property>
    <property name="toolTip">
     <string>Rear</string>
    </property>
    <property name="text">
     <string/>
    </property>
    <property name="autoExclusive">
     <bool>false</bool>
    </property>
    <attribute name="buttonGroup">
     <string notr="true">buttonGroup</string>
    </attribute>
   </widget>
   <widget class="QRadioButton" name="Rb3">
    <property name="geometry">
     <rect>
      <x>62</x>
      <y>140</y>
      <width>16</width>
      <height>13</height>
     </rect>
    </property>
    <property name="toolTip">
     <string>Left Side</string>
    </property>
    <property name="text">
     <string/>
    </property>
    <property name="autoExclusive">
     <bool>false</bool>
    </property>
    <attribute name="buttonGroup">
     <string notr="true">buttonGroup</string>
    </attribute>
   </widget>
   <widget class="QRadioButton" name="Rb4">
    <property name="geometry">
     <rect>
      <x>84</x>
      <y>140</y>
      <width>17</width>
      <height>13</height>
     </rect>
    </property>
    <property name="toolTip">
     <string>Center</string>
    </property>
    <property name="text">
     <string/>
    </property>
    <property name="checked">
     <bool>true</bool>
    </property>
    <property name="autoExclusive">
     <bool>false</bool>
    </property>
    <attribute name="buttonGroup">
     <string notr="true">buttonGroup</string>
    </attribute>
   </widget>
   <widget class="QRadioButton" name="Rb5">
    <property name="geometry">
     <rect>
      <x>107</x>
      <y>140</y>
      <width>16</width>
      <height>13</height>
     </rect>
    </property>
    <property name="toolTip">
     <string>Right Side</string>
    </property>
    <property name="text">
     <string/>
    </property>
    <property name="autoExclusive">
     <bool>false</bool>
    </property>
    <attribute name="buttonGroup">
     <string notr="true">buttonGroup</string>
    </attribute>
   </widget>
   <widget class="QRadioButton" name="Rb2">
    <property name="geometry">
     <rect>
      <x>107</x>
      <y>159</y>
      <width>16</width>
      <height>13</height>
     </rect>
    </property>
    <property name="toolTip">
     <string>Right Front</string>
    </property>
    <property name="text">
     <string/>
    </property>
    <property name="autoExclusive">
     <bool>false</bool>
    </property>
    <attribute name="buttonGroup">
     <string notr="true">buttonGroup</string>
    </attribute>
   </widget>
   <widget class="QRadioButton" name="Rb6">
    <property name="geometry">
     <rect>
      <x>62</x>
      <y>121</y>
      <width>16</width>
      <height>13</height>
     </rect>
    </property>
    <property name="toolTip">
     <string>Left Rear</string>
    </property>
    <property name="text">
     <string/>
    </property>
    <property name="autoExclusive">
     <bool>false</bool>
    </property>
    <attribute name="buttonGroup">
     <string notr="true">buttonGroup</string>
    </attribute>
   </widget>
   <widget class="QRadioButton" name="Rb1">
    <property name="geometry">
     <rect>
      <x>84</x>
      <y>159</y>
      <width>17</width>
      <height>13</height>
     </rect>
    </property>
    <property name="toolTip">
     <string>Front</string>
    </property>
    <property name="text">
     <string/>
    </property>
    <property name="autoExclusive">
     <bool>false</bool>
    </property>
    <attribute name="buttonGroup">
     <string notr="true">buttonGroup</string>
    </attribute>
   </widget>
  </widget>

Добавление всего FileNamingWidget.ui кусками:

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>Filename_Folder_Widget</class>
 <widget class="QTabWidget" name="Filename_Folder_Widget">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>261</width>
    <height>550</height>
   </rect>
  </property>
  <property name="sizePolicy">
   <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
    <horstretch>0</horstretch>
    <verstretch>0</verstretch>
   </sizepolicy>
  </property>
  <property name="minimumSize">
   <size>
    <width>260</width>
    <height>550</height>
   </size>
  </property>
  <property name="windowTitle">
   <string>TabWidget</string>
  </property>
  <property name="currentIndex">
   <number>0</number>
  </property>
  <widget class="QWidget" name="FileNamingTab">
   <attribute name="title">
    <string>File Naming</string>
   </attribute>
   <widget class="QLabel" name="AspectLabel">
    <property name="geometry">
     <rect>
      <x>10</x>
      <y>140</y>
      <width>47</width>
      <height>13</height>
     </rect>
    </property>
    <property name="text">
     <string>Aspect</string>
    </property>
   </widget>
   <widget class="QLabel" name="SubjectLabel">
    <property name="geometry">
     <rect>
      <x>10</x>
      <y>30</y>
      <width>47</width>
      <height>21</height>
     </rect>
    </property>
    <property name="maximumSize">
     <size>
      <width>16777215</width>
      <height>16777215</height>
     </size>
    </property>
    <property name="text">
     <string>Subject</string>
    </property>
   </widget>
   <widget class="QLabel" name="RangeLabel">
    <property name="geometry">
     <rect>
      <x>10</x>
      <y>60</y>
      <width>47</width>
      <height>21</height>
     </rect>
    </property>
    <property name="text">
     <string>Range</string>
    </property>
   </widget>
   <widget class="QLabel" name="PositionLabel">
    <property name="geometry">
     <rect>
      <x>10</x>
      <y>90</y>
      <width>47</width>
      <height>21</height>
     </rect>
    </property>
    <property name="text">
     <string>Position</string>
    </property>
   </widget>
   <widget class="QComboBox" name="SubjectDropDown">
    <property name="geometry">
     <rect>
      <x>60</x>
      <y>30</y>
      <width>91</width>
      <height>22</height>
     </rect>
    </property>
   </widget>
   <widget class="QComboBox" name="RangeDropDown">
    <property name="geometry">
     <rect>
      <x>60</x>
      <y>60</y>
      <width>91</width>
      <height>22</height>
     </rect>
    </property>
   </widget>
   <widget class="QComboBox" name="PositionDropDown">
    <property name="geometry">
     <rect>
      <x>60</x>
      <y>90</y>
      <width>91</width>
      <height>22</height>
     </rect>
    </property>
   </widget>
   <widget class="QLabel" name="FOVLabel">
    <property name="geometry">
     <rect>
      <x>10</x>
      <y>190</y>
      <width>47</width>
      <height>21</height>
     </rect>
    </property>
    <property name="text">
     <string>FOV</string>
    </property>
   </widget>
   <widget class="QComboBox" name="FOVDropDown">
    <property name="geometry">
     <rect>
      <x>60</x>
      <y>190</y>
      <width>91</width>
      <height>22</height>
     </rect>
    </property>
   </widget>
   <widget class="QPushButton" name="EditOptionsButton">
    <property name="geometry">
     <rect>
      <x>20</x>
      <y>310</y>
      <width>91</width>
      <height>21</height>
     </rect>
    </property>
    <property name="text">
     <string>Edit I/O Settings</string>
    </property>
   </widget>
   <widget class="QLabel" name="RunLabel">
    <property name="geometry">
     <rect>
      <x>10</x>
      <y>220</y>
      <width>47</width>
      <height>21</height>
     </rect>
    </property>
    <property name="text">
     <string>Run #</string>
    </property>
   </widget>
   <widget class="QLabel" name="TakeLabel">
    <property name="geometry">
     <rect>
      <x>10</x>
      <y>250</y>
      <width>47</width>
      <height>21</height>
     </rect>
    </property>
    <property name="text">
     <string>Take #</string>
    </property>
   </widget>
   <widget class="Line" name="HorizLine1">
    <property name="geometry">
     <rect>
      <x>10</x>
      <y>300</y>
      <width>221</width>
      <height>16</height>
     </rect>
    </property>
    <property name="orientation">
     <enum>Qt::Horizontal</enum>
    </property>
   </widget>
   <widget class="QPushButton" name="LoadButton">
    <property name="geometry">
     <rect>
      <x>60</x>
      <y>340</y>
      <width>51</width>
      <height>23</height>
     </rect>
    </property>
    <property name="text">
     <string>Load</string>
    </property>
   </widget>
   <widget class="QPushButton" name="SaveButton">
    <property name="geometry">
     <rect>
      <x>120</x>
      <y>340</y>
      <width>51</width>
      <height>23</height>
     </rect>
    </property>
    <property name="text">
     <string>Save</string>
    </property>
   </widget>
   <widget class="QPushButton" name="SettingsButton">
    <property name="geometry">
     <rect>
      <x>120</x>
      <y>310</y>
      <width>101</width>
      <height>23</height>
     </rect>
    </property>
    <property name="text">
     <string>Structure Settings</string>
    </property>
   </widget>
   <widget class="QTextEdit" name="NotesInput">
    <property name="geometry">
     <rect>
      <x>10</x>
      <y>390</y>
      <width>221</width>
      <height>111</height>
     </rect>
    </property>
   </widget>
   <widget class="QLabel" name="NotesLabel">
    <property name="geometry">
     <rect>
      <x>10</x>
      <y>370</y>
      <width>211</width>
      <height>21</height>
     </rect>
    </property>
    <property name="text">
     <string>Notes</string>
    </property>
   </widget>
   <widget class="QPushButton" name="SaveNotesButton">
    <property name="geometry">
     <rect>
      <x>70</x>
      <y>500</y>
      <width>81</width>
      <height>23</height>
     </rect>
    </property>
    <property name="text">
     <string>Save Notes</string>
    </property>
   </widget>
   <widget class="QTextEdit" name="AspectPreview">
    <property name="geometry">
     <rect>
      <x>170</x>
      <y>140</y>
      <width>61</width>
      <height>21</height>
     </rect>
    </property>
    <property name="verticalScrollBarPolicy">
     <enum>Qt::ScrollBarAlwaysOff</enum>
    </property>
    <property name="horizontalScrollBarPolicy">
     <enum>Qt::ScrollBarAlwaysOff</enum>
    </property>
    <property name="readOnly">
     <bool>true</bool>
    </property>
   </widget>
   <widget class="QTextEdit" name="SubjectPreview">
    <property name="geometry">
     <rect>
      <x>160</x>
      <y>30</y>
      <width>71</width>
      <height>21</height>
     </rect>
    </property>
    <property name="autoFillBackground">
     <bool>false</bool>
    </property>
    <property name="verticalScrollBarPolicy">
     <enum>Qt::ScrollBarAlwaysOff</enum>
    </property>
    <property name="horizontalScrollBarPolicy">
     <enum>Qt::ScrollBarAlwaysOff</enum>
    </property>
    <property name="readOnly">
     <bool>true</bool>
    </property>
   </widget>
   <widget class="QTextEdit" name="RangePreview">
    <property name="geometry">
     <rect>
      <x>160</x>
      <y>60</y>
      <width>71</width>
      <height>21</height>
     </rect>
    </property>
    <property name="verticalScrollBarPolicy">
     <enum>Qt::ScrollBarAlwaysOff</enum>
    </property>
    <property name="horizontalScrollBarPolicy">
     <enum>Qt::ScrollBarAlwaysOff</enum>
    </property>
    <property name="readOnly">
     <bool>true</bool>
    </property>
   </widget>
   <widget class="QTextEdit" name="PositionPreview">
    <property name="geometry">
     <rect>
      <x>160</x>
      <y>90</y>
      <width>71</width>
      <height>21</height>
     </rect>
    </property>
    <property name="verticalScrollBarPolicy">
     <enum>Qt::ScrollBarAlwaysOff</enum>
    </property>
    <property name="horizontalScrollBarPolicy">
     <enum>Qt::ScrollBarAlwaysOff</enum>
    </property>
    <property name="readOnly">
     <bool>true</bool>
    </property>
   </widget>
   <widget class="QTextEdit" name="FOVPreview">
    <property name="geometry">
     <rect>
      <x>160</x>
      <y>190</y>
      <width>71</width>
      <height>21</height>
     </rect>
    </property>
    <property name="verticalScrollBarPolicy">
     <enum>Qt::ScrollBarAlwaysOff</enum>
    </property>
    <property name="horizontalScrollBarPolicy">
     <enum>Qt::ScrollBarAlwaysOff</enum>
    </property>
    <property name="readOnly">
     <bool>true</bool>
    </property>
   </widget>
   <widget class="QTextEdit" name="RunPreview">
    <property name="geometry">
     <rect>
      <x>160</x>
      <y>220</y>
      <width>71</width>
      <height>21</height>
     </rect>
    </property>
    <property name="verticalScrollBarPolicy">
     <enum>Qt::ScrollBarAlwaysOff</enum>
    </property>
    <property name="horizontalScrollBarPolicy">
     <enum>Qt::ScrollBarAlwaysOff</enum>
    </property>
    <property name="readOnly">
     <bool>true</bool>
    </property>
   </widget>
   <widget class="QTextEdit" name="SuffixInput">
    <property name="geometry">
     <rect>
      <x>60</x>
      <y>280</y>
      <width>171</width>
      <height>21</height>
     </rect>
    </property>
    <property name="verticalScrollBarPolicy">
     <enum>Qt::ScrollBarAlwaysOff</enum>
    </property>
    <property name="horizontalScrollBarPolicy">
     <enum>Qt::ScrollBarAlwaysOff</enum>
    </property>
   </widget>
   <widget class="QLabel" name="SuffixLabel_2">
    <property name="geometry">
     <rect>
      <x>10</x>
      <y>280</y>
      <width>47</width>
      <height>21</height>
     </rect>
    </property>
    <property name="text">
     <string>Suffix</string>
    </property>
   </widget>
   <widget class="QTextEdit" name="TakePreview">
    <property name="geometry">
     <rect>
      <x>160</x>
      <y>250</y>
      <width>71</width>
      <height>21</height>
     </rect>
    </property>
    <property name="verticalScrollBarPolicy">
     <enum>Qt::ScrollBarAlwaysOff</enum>
    </property>
    <property name="horizontalScrollBarPolicy">
     <enum>Qt::ScrollBarAlwaysOff</enum>
    </property>
    <property name="readOnly">
     <bool>true</bool>
    </property>
   </widget>
   <widget class="QSpinBox" name="RunSpin">
    <property name="geometry">
     <rect>
      <x>60</x>
      <y>220</y>
      <width>91</width>
      <height>22</height>
     </rect>
    </property>
    <property name="frame">
     <bool>true</bool>
    </property>
    <property name="maximum">
     <number>10000</number>
    </property>
   </widget>
   <widget class="QSpinBox" name="TakeSpin">
    <property name="geometry">
     <rect>
      <x>60</x>
      <y>250</y>
      <width>91</width>
      <height>22</height>
     </rect>
    </property>
   </widget>
   <widget class="QLabel" name="SubjectLabel_2">
    <property name="geometry">
     <rect>
      <x>166</x>
      <y>0</y>
      <width>61</width>
      <height>21</height>
     </rect>
    </property>
    <property name="font">
     <font>
      <weight>75</weight>
      <bold>true</bold>
     </font>
    </property>
    <property name="text">
     <string>Output</string>
    </property>
    <property name="alignment">
     <set>Qt::AlignCenter</set>
    </property>
   </widget>
   <widget class="QLabel" name="SubjectLabel_3">
    <property name="geometry">
     <rect>
      <x>60</x>
      <y>0</y>
      <width>91</width>
      <height>21</height>
     </rect>
    </property>
    <property name="font">
     <font>
      <weight>75</weight>
      <bold>true</bold>
     </font>
    </property>
    <property name="text">
     <string>Input</string>
    </property>
    <property name="alignment">
     <set>Qt::AlignCenter</set>
    </property>
   </widget>
   <widget class="QLabel" name="SubjectLabel_4">
    <property name="geometry">
     <rect>
      <x>10</x>
      <y>0</y>
      <width>31</width>
      <height>21</height>
     </rect>
    </property>
    <property name="font">
     <font>
      <weight>75</weight>
      <bold>true</bold>
     </font>
    </property>
    <property name="text">
     <string>Field</string>
    </property>
    <property name="alignment">
     <set>Qt::AlignCenter</set>
    </property>
   </widget>
   <widget class="Line" name="HorizLine1_2">
    <property name="geometry">
     <rect>
      <x>10</x>
      <y>360</y>
      <width>221</width>
      <height>16</height>
     </rect>
    </property>
    <property name="orientation">
     <enum>Qt::Horizontal</enum>
    </property>
   </widget>

Чанк с переключателями:

   <widget class="QRadioButton" name="Rb8">
    <property name="geometry">
     <rect>
      <x>107</x>
      <y>121</y>
      <width>16</width>
      <height>13</height>
     </rect>
    </property>
    <property name="toolTip">
     <string>Right Rear</string>
    </property>
    <property name="text">
     <string/>
    </property>
    <property name="autoExclusive">
     <bool>false</bool>
    </property>
    <attribute name="buttonGroup">
     <string notr="true">buttonGroup</string>
    </attribute>
   </widget>
   <widget class="QRadioButton" name="Rb0">
    <property name="enabled">
     <bool>true</bool>
    </property>
    <property name="geometry">
     <rect>
      <x>62</x>
      <y>159</y>
      <width>16</width>
      <height>13</height>
     </rect>
    </property>
    <property name="toolTip">
     <string>Left Front</string>
    </property>
    <property name="text">
     <string/>
    </property>
    <property name="autoExclusive">
     <bool>false</bool>
    </property>
    <attribute name="buttonGroup">
     <string notr="true">buttonGroup</string>
    </attribute>
   </widget>
   <widget class="QRadioButton" name="Rb9">
    <property name="geometry">
     <rect>
      <x>130</x>
      <y>140</y>
      <width>13</width>
      <height>13</height>
     </rect>
    </property>
    <property name="toolTip">
     <string>Multi Aspect</string>
    </property>
    <property name="text">
     <string/>
    </property>
    <property name="shortcut">
     <string/>
    </property>
    <property name="checked">
     <bool>false</bool>
    </property>
    <property name="autoExclusive">
     <bool>false</bool>
    </property>
    <attribute name="buttonGroup">
     <string notr="true">buttonGroup</string>
    </attribute>
   </widget>
   <widget class="QRadioButton" name="Rb7">
    <property name="geometry">
     <rect>
      <x>84</x>
      <y>121</y>
      <width>17</width>
      <height>13</height>
     </rect>
    </property>
    <property name="toolTip">
     <string>Rear</string>
    </property>
    <property name="text">
     <string/>
    </property>
    <property name="autoExclusive">
     <bool>false</bool>
    </property>
    <attribute name="buttonGroup">
     <string notr="true">buttonGroup</string>
    </attribute>
   </widget>
   <widget class="QRadioButton" name="Rb3">
    <property name="geometry">
     <rect>
      <x>62</x>
      <y>140</y>
      <width>16</width>
      <height>13</height>
     </rect>
    </property>
    <property name="toolTip">
     <string>Left Side</string>
    </property>
    <property name="text">
     <string/>
    </property>
    <property name="autoExclusive">
     <bool>false</bool>
    </property>
    <attribute name="buttonGroup">
     <string notr="true">buttonGroup</string>
    </attribute>
   </widget>
   <widget class="QRadioButton" name="Rb4">
    <property name="geometry">
     <rect>
      <x>84</x>
      <y>140</y>
      <width>17</width>
      <height>13</height>
     </rect>
    </property>
    <property name="toolTip">
     <string>Center</string>
    </property>
    <property name="text">
     <string/>
    </property>
    <property name="checked">
     <bool>true</bool>
    </property>
    <property name="autoExclusive">
     <bool>false</bool>
    </property>
    <attribute name="buttonGroup">
     <string notr="true">buttonGroup</string>
    </attribute>
   </widget>

(Слишком много хлопот, чтобы вставить весь uifile)


person Tim Williams    schedule 18.06.2018    source источник
comment
поделитесь своим .ui-   -  person eyllanesc    schedule 18.06.2018
comment
Как прикрепить файл?   -  person Tim Williams    schedule 18.06.2018
comment
Скопируйте содержимое, затем вставьте его в свой пост, выделите текст и нажмите Ctrl + K.   -  person eyllanesc    schedule 18.06.2018
comment
не делитесь только одним куском, делитесь всеми .ui, я хочу посмотреть, в чем проблема.   -  person eyllanesc    schedule 18.06.2018
comment
Я пытался, но это превысило лимит. Я думаю, я мог бы сделать это кусками. Я проверю ваш файл file2.ui и посмотрю, что произойдет, когда я сохраню его из QtDesigner. Спасибо.   -  person Tim Williams    schedule 18.06.2018
comment
Вы можете загрузить его на другие носители, такие как github, drive, dropbox и т. д., которые поддерживают больше строк, и поделиться ссылкой. :)   -  person eyllanesc    schedule 18.06.2018


Ответы (1)


Извините, но я скачал ваш файл FileNamingWidget.ui с github.com/tjwilli58/scratch-files/blob/master/ и не могу понять, что не так?

Попытайся:

import sys
from PyQt5.QtWidgets import *
from PyQt5.QtCore    import *
from PyQt5.QtGui     import *
from PyQt5.uic import loadUi

class Tutorial(QTabWidget):   #(QMainWindow):   # QWidget
    def __init__(self):
        super(Tutorial, self).__init__()
        loadUi('FileNamingWidget.ui', self)

        print(self.Rb6.geometry(), self.Rb7.geometry(), self.Rb8.geometry())
        print(self.Rb3.geometry(), self.Rb4.geometry(), self.Rb5.geometry(), self.Rb9.geometry())
        print(self.Rb0.geometry(), self.Rb1.geometry(), self.Rb2.geometry())
        print()

        self.Rb0.toggled.connect(self.rbChecked) 
        self.Rb1.toggled.connect(self.rbChecked)
        self.Rb2.toggled.connect(self.rbChecked)
        self.Rb3.toggled.connect(self.rbChecked)
        self.Rb4.toggled.connect(self.rbChecked)
        self.Rb5.toggled.connect(self.rbChecked)
        self.Rb6.toggled.connect(self.rbChecked)
        self.Rb7.toggled.connect(self.rbChecked)
        self.Rb8.toggled.connect(self.rbChecked)
        self.Rb9.toggled.connect(self.rbChecked)

    def rbChecked(self):
        if self.sender().isChecked():
            print(self.sender().objectName())


if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = Tutorial()
    ex.show()
    sys.exit(app.exec_())

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

person S. Nick    schedule 18.06.2018
comment
Но мне нужно, чтобы все 10 RB были эксклюзивными. Можно ли группировать GroupBox? - person Tim Williams; 18.06.2018
comment
Я добавил, посмотрите. - person S. Nick; 18.06.2018
comment
Я взял ваш файл fly2.ui, прочитал его в QtDesigner и сделал сохранение. Нет переупорядочения. Это может быть потому, что у меня есть эти кнопки как часть вкладки в QTabWidget. Я постараюсь разместить свой файл на GitHub или, может быть, на Google Диске. - person Tim Williams; 18.06.2018
comment
Я создал репозиторий GitHub. Вот ссылка на файл. github.com/tjwilli58/scratch-files/blob/master/ - person Tim Williams; 18.06.2018
comment
Извините, но я скачал ваш файл FileNamingWidget.ui с github.com/tjwilli58/scratch-files/blob/master/ и не могу понять, что не так? Посмотрите на обновленный код. - person S. Nick; 19.06.2018
comment
С. Ник, спасибо, что уделили этому время. Я скопировал код вашего учебника и запустил его. Здесь тоже все нормально. Что-то еще должно происходить в моей программе, что вызывает эту проблему. Мне нужно разбить его на меньшую программу, которая все еще вызывает проблему. Пока я не найду время, чтобы отследить это, я просто отредактирую uifile после того, как сохраню его из QtDesigner. - person Tim Williams; 19.06.2018