0 / 0 / 0
Регистрация: 25.02.2023
Сообщений: 22

Задача "Текстовый флаг"

18.09.2023, 22:11. Показов 1802. Ответов 1
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
подскажите пожалуйста, что не так, выдает вот такую ошибку:

Traceback (most recent call last):
File "/temp/executing/test.py", line 12, in <module>
solO = sol.FlagMaker()
^^^^^^^^^^^^^^^
File "/temp/executing/solution.py", line 358, in __init__
uic.loadUi('flag.ui', self)
File "/usr/local/lib/python3.11/dist-packages/PyQt5/uic/__init__.py", line 241, in loadUi
return DynamicUILoader(package).loadUi(uifile, baseinstance, resource_suffix)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/PyQt5/uic/Loader/loader.py", line 66, in loadUi
return self.parse(filename, resource_suffix)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/PyQt5/uic/uiparser.py", line 1020, in parse
document = parse(filename)
^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/xml/etree/ElementTree.py", line 1218, in parse
tree.parse(source, parser)
File "/usr/lib/python3.11/xml/etree/ElementTree.py", line 569, in parse


File is too long to be displayed fully

Python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
import sys
 
from PyQt5 import uic
from PyQt5.QtWidgets import QApplication, QMainWindow
 
template = """<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>MainWindow</class>
 <widget class="QMainWindow" name="MainWindow">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>750</width>
    <height>510</height>
   </rect>
  </property>
  <property name="font">
   <font>
    <pointsize>9</pointsize>
   </font>
  </property>
  <property name="windowTitle">
   <string>Текстовый флаг</string>
  </property>
  <widget class="QWidget" name="centralwidget">
   <widget class="QWidget" name="verticalLayoutWidget">
    <property name="geometry">
     <rect>
      <x>30</x>
      <y>110</y>
      <width>201</width>
      <height>211</height>
     </rect>
    </property>
    <layout class="QVBoxLayout" name="layout_1">
     <item>
      <widget class="QRadioButton" name="rb_1_1">
       <property name="styleSheet">
        <string notr="true">background-color: rgb(255, 5, 21);
font: 10pt &quot;MS Shell Dlg 2&quot;;</string>
       </property>
       <property name="text">
        <string>Красный</string>
       </property>
       <property name="checked">
        <bool>true</bool>
       </property>
       <attribute name="buttonGroup">
        <string notr="true">buttonGroup</string>
       </attribute>
      </widget>
     </item>
     <item>
      <widget class="QRadioButton" name="rb_1_2">
       <property name="styleSheet">
        <string notr="true">font: 10pt &quot;MS Shell Dlg 2&quot;;
background-color: rgb(138, 255, 105);</string>
       </property>
       <property name="text">
        <string>Зеленый</string>
       </property>
       <attribute name="buttonGroup">
        <string notr="true">buttonGroup</string>
       </attribute>
      </widget>
     </item>
     <item>
      <widget class="QRadioButton" name="rb_1_3">
       <property name="styleSheet">
        <string notr="true">font: 10pt &quot;MS Shell Dlg 2&quot;;
background-color: rgb(103, 111, 255);</string>
       </property>
       <property name="text">
        <string>Синий</string>
       </property>
       <attribute name="buttonGroup">
        <string notr="true">buttonGroup</string>
       </attribute>
      </widget>
     </item>
     <item>
      <widget class="QRadioButton" name="rb_1_4">
       <property name="styleSheet">
        <string notr="true">font: 10pt &quot;MS Shell Dlg 2&quot;;
background-color: rgb(255, 220, 19);</string>
       </property>
       <property name="text">
        <string>Желтый</string>
       </property>
       <attribute name="buttonGroup">
        <string notr="true">buttonGroup</string>
       </attribute>
      </widget>
     </item>
    </layout>
   </widget>
   <widget class="QWidget" name="verticalLayoutWidget_2">
    <property name="geometry">
     <rect>
      <x>260</x>
      <y>110</y>
      <width>211</width>
      <height>211</height>
     </rect>
    </property>
    <layout class="QVBoxLayout" name="layout_2">
     <item>
      <widget class="QRadioButton" name="rb_2_1">
       <property name="styleSheet">
        <string notr="true">font: 10pt &quot;MS Shell Dlg 2&quot;;
background-color: rgb(255, 0, 4);</string>
       </property>
       <property name="text">
        <string>Красный</string>
       </property>
       <property name="checked">
        <bool>true</bool>
       </property>
       <attribute name="buttonGroup">
        <string notr="true">buttonGroup_2</string>
       </attribute>
      </widget>
     </item>
     <item>
      <widget class="QRadioButton" name="rb_2_2">
       <property name="styleSheet">
        <string notr="true">font: 10pt &quot;MS Shell Dlg 2&quot;;
background-color: rgb(101, 255, 114);</string>
       </property>
       <property name="text">
        <string>Зеленый</string>
       </property>
       <property name="checked">
        <bool>false</bool>
       </property>
       <attribute name="buttonGroup">
        <string notr="true">buttonGroup_2</string>
       </attribute>
      </widget>
     </item>
     <item>
      <widget class="QRadioButton" name="rb_2_3">
       <property name="styleSheet">
        <string notr="true">font: 10pt &quot;MS Shell Dlg 2&quot;;
background-color: rgb(110, 112, 255);</string>
       </property>
       <property name="text">
        <string>Синий</string>
       </property>
       <attribute name="buttonGroup">
        <string notr="true">buttonGroup_2</string>
       </attribute>
      </widget>
     </item>
     <item>
      <widget class="QRadioButton" name="rb_2_4">
       <property name="styleSheet">
        <string notr="true">font: 10pt &quot;MS Shell Dlg 2&quot;;
background-color: rgb(255, 220, 19);</string>
       </property>
       <property name="text">
        <string>Желтый</string>
       </property>
       <attribute name="buttonGroup">
        <string notr="true">buttonGroup_2</string>
       </attribute>
      </widget>
     </item>
    </layout>
   </widget>
   <widget class="QWidget" name="verticalLayoutWidget_3">
    <property name="geometry">
     <rect>
      <x>500</x>
      <y>110</y>
      <width>211</width>
      <height>211</height>
     </rect>
    </property>
    <layout class="QVBoxLayout" name="layout_3">
     <item>
      <widget class="QRadioButton" name="rb_3_1">
       <property name="styleSheet">
        <string notr="true">font: 10pt &quot;MS Shell Dlg 2&quot;;
background-color: rgb(255, 0, 12);</string>
       </property>
       <property name="text">
        <string>Красный</string>
       </property>
       <property name="checked">
        <bool>true</bool>
       </property>
       <attribute name="buttonGroup">
        <string notr="true">buttonGroup_3</string>
       </attribute>
      </widget>
     </item>
     <item>
      <widget class="QRadioButton" name="rb_3_2">
       <property name="styleSheet">
        <string notr="true">font: 10pt &quot;MS Shell Dlg 2&quot;;
background-color: rgb(75, 255, 117);</string>
       </property>
       <property name="text">
        <string>Зеленый</string>
       </property>
       <attribute name="buttonGroup">
        <string notr="true">buttonGroup_3</string>
       </attribute>
      </widget>
     </item>
     <item>
      <widget class="QRadioButton" name="rb_3_3">
       <property name="styleSheet">
        <string notr="true">font: 10pt &quot;MS Shell Dlg 2&quot;;
background-color: rgb(120, 127, 255);</string>
       </property>
       <property name="text">
        <string>Синий</string>
       </property>
       <property name="checked">
        <bool>false</bool>
       </property>
       <attribute name="buttonGroup">
        <string notr="true">buttonGroup_3</string>
       </attribute>
      </widget>
     </item>
     <item>
      <widget class="QRadioButton" name="rb_3_4">
       <property name="styleSheet">
        <string notr="true">font: 10pt &quot;MS Shell Dlg 2&quot;;
background-color: rgb(255, 220, 19);</string>
       </property>
       <property name="text">
        <string>Желтый</string>
       </property>
       <attribute name="buttonGroup">
        <string notr="true">buttonGroup_3</string>
       </attribute>
      </widget>
     </item>
    </layout>
   </widget>
   <widget class="QLabel" name="label">
    <property name="geometry">
     <rect>
      <x>20</x>
      <y>20</y>
      <width>201</width>
      <height>81</height>
     </rect>
    </property>
    <property name="font">
     <font>
      <pointsize>24</pointsize>
     </font>
    </property>
    <property name="text">
     <string>Цвет №1</string>
    </property>
   </widget>
   <widget class="QLabel" name="label_2">
    <property name="geometry">
     <rect>
      <x>250</x>
      <y>20</y>
      <width>191</width>
      <height>81</height>
     </rect>
    </property>
    <property name="font">
     <font>
      <pointsize>24</pointsize>
     </font>
    </property>
    <property name="text">
     <string>Цвет №2</string>
    </property>
   </widget>
   <widget class="QLabel" name="label_3">
    <property name="geometry">
     <rect>
      <x>500</x>
      <y>20</y>
      <width>191</width>
      <height>81</height>
     </rect>
    </property>
    <property name="font">
     <font>
      <pointsize>24</pointsize>
     </font>
    </property>
    <property name="text">
     <string>Цвет №3</string>
    </property>
   </widget>
   <widget class="QPushButton" name="flag_button">
    <property name="geometry">
     <rect>
      <x>602</x>
      <y>340</y>
      <width>111</width>
      <height>31</height>
     </rect>
    </property>
    <property name="text">
     <string>Нарисовать</string>
    </property>
   </widget>
   <widget class="QLabel" name="label_4">
    <property name="geometry">
     <rect>
      <x>40</x>
      <y>400</y>
      <width>668</width>
      <height>41</height>
     </rect>
    </property>
    <property name="font">
     <font>
      <pointsize>9</pointsize>
     </font>
    </property>
    <property name="text">
     <string>TextLabel</string>
    </property>
   </widget>
  </widget>
  <widget class="QMenuBar" name="menubar">
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>750</width>
     <height>26</height>
    </rect>
   </property>
  </widget>
  <widget class="QStatusBar" name="statusbar"/>
 </widget>
 <resources/>
 <connections/>
 <buttongroups>
  <buttongroup name="buttonGroup"/>
  <buttongroup name="buttonGroup_3"/>
  <buttongroup name="buttonGroup_2"/>
 </buttongroups>
</ui>
"""
 
 
class FlagMaker(QMainWindow):
    def __init__(self):
        super().__init__()
        uic.loadUi('flag.ui', self)
        self.flag_button.clicked.connect(self.make_flag)
 
    def make_flag(self):
        self.label_4.setText(f'Цвета: {self.buttonGroup.checkedButton().text()}, '
                             f'{self.buttonGroup_2.checkedButton().text()} и '
                             f'{self.buttonGroup_3.checkedButton().text()}')
 
 
if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = FlagMaker()
    ex.show()
    sys.exit(app.exec())
0
Programming
Эксперт
39485 / 9562 / 3019
Регистрация: 12.04.2006
Сообщений: 41,671
Блог
18.09.2023, 22:11
Ответы с готовыми решениями:

Задача "Текстовый флаг"
&quot;Напишите приложение «Текстовый флаг» с графическим пользовательским интерфейсом на PyQT. Пользователь должен иметь возможность...

Текстовый флаг
всем привет, задачка текстовый флаг из ЯЛ: Напишите приложение «Текстовый флаг» с графическим пользовательским интерфейсом на PyQT. ...

Почему если флаг состояния потока eof поднят, то флаг good опущен?
Почему если флаг состояния потока eof поднят, то флаг good опущен? Это нонсенс, друзья. Здесь прочтём, что флаг goodbit потока...

1
 Аватар для kapbepucm
1568 / 741 / 321
Регистрация: 02.05.2020
Сообщений: 1,660
19.09.2023, 21:08
Ваш пример запускается без подобных ошибок, проверяйте файл flag.ui
1
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
inter-admin
Эксперт
29715 / 6470 / 2152
Регистрация: 06.03.2009
Сообщений: 28,500
Блог
19.09.2023, 21:08
Помогаю со студенческими работами здесь

Нарисовать на экране дисплея флаг РФ, Японский флаг
Нарисовать на экране дисплея флаг РФ, Японский флаг 300*200px Добавлено через 22 часа 20 минут Помогите пожалуйсто)))

Задача с использованием структуры «текстовый файл» (в файле хранится текст) 1) Переписать в другой текстовый файл самую
Задача с использованием структуры «текстовый файл» (в файле хранится текст) 1) Переписать в другой текстовый файл самую короткую и самую...

Как реализовать флаг cat -v флаг в си?
мне предстоит задача которую не знаю как правильно реализовать. и первый вопрос который у меня возник это что такое м-нотация? у нас...

Задача "Флаг"
Флаг состоит из 3х цветов (зелёный, красный, синий) и N-полосок. Сколькома способами можно нарисовать флаг, чтобы цвета соседних полосок не...

Задача на текстовый файл
Помогите решить задачу) Дан текстовый файл, каждая строка которого изображает целое или вещественное число, дополненное слева ...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
2
Ответ Создать тему
Опции темы

Новые блоги и статьи
Архитектура слоя интернета для сервера-слоя.
Hrethgir 11.04.2026
В продолжение https:/ / www. cyberforum. ru/ blogs/ 223907/ 10860. html Знаешь что я подумал? Раз мы все источники пишем в голове ветки, то ничего не мешает добавить в голову такой источник, который сам. . .
Подстановка значения реквизита справочника в табличную часть документа
Maks 10.04.2026
Алгоритм из решения ниже реализован на примере нетипового документа "ПланированиеПерсонала", разработанного в конфигурации КА2. Задача: при выборе сотрудника (справочник Сотрудники) в ТЧ документа. . .
Очистка реквизитов документа при копировании
Maks 09.04.2026
Алгоритм из решения ниже применим как для типовых, так и для нетиповых документов на самых различных конфигурациях. Задача: при копировании документа очищать определенные реквизиты и табличную. . .
модель ЗдравоСохранения 8. Подготовка к разному выполнению заданий
anaschu 08.04.2026
https:/ / github. com/ shumilovas/ med2. git main ветка * содержимое блока дэлэй из старой модели теперь внутри зайца новой модели 8ATzM_2aurI
Блокировка документа от изменений, если он открыт у другого пользователя
Maks 08.04.2026
Алгоритм из решения ниже реализован на примере нетипового документа, разработанного в конфигурации КА2. Задача: запретить редактирование документа, если он открыт у другого пользователя. / / . . .
Система безопасности+живучести для сервера-слоя интернета (сети). Двойная привязка.
Hrethgir 08.04.2026
Далее были размышления о системе безопасности. Сообщения с наклонным текстом - мои. А как нам будет можно проверить, что ссылка наша, а не подделана хулиганами, которая выбросит на другую ветку и. . .
Модель ЗдрввоСохранения 7: больше работников, больше ресурсов.
anaschu 08.04.2026
работников и заданий может быть сколько угодно, но настроено всё так, что используется пока что только 20% kYBz3eJf3jQ
Дальние перспективы сервера - слоя сети с космологическим дизайном интефейса карты и логики.
Hrethgir 07.04.2026
Дальнейшее ближайшее планирование вывело к размышлениям над дальними перспективами. И вот тут может быть даже будут нужны оценки специалистов, так как в дальних перспективах всё может очень сильно. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru