我正在构建一个用于任务管理的桌面软件。在这个应用程序中,我在python代码中创建小部件(以便它在不需要时不会在屏幕上占用太多空间)。 之后,在我创建的新布局中,我创建了另一个方框布局,我将在其中填写我的任务。我的问题是,我无法将任务添加到该框布局中,因为某种原因,我的软件无法识别我创建的ID。添加部分代码:
tasks_layout = RelativeLayout(size_hint=(1, 0.4), id='taskks')
tasks = BoxLayout(spacing=10, orientation='horizontal', id="tasks")
tasks_layout.add_widget(tasks)
date = TextInput()
info = TextInput()
date_string = date.text
info_string = info.text
new_task_inputs_box.add_widget(date)
new_task_inputs_box.add_widget(info)
new_task_button = Button(text="Add \n Mission")
new_task_button.bind(on_press=lambda x: self.ids.cards.new.taskks.tasks.add_widget(Label(text=date_string+"\n"+info_string)))
File "kivy\weakproxy.pyx", line 32, in kivy.weakproxy.WeakProxy.__getattr__
AttributeError: 'GridLayout' object has no attribute 'new'
修理
不使用ID:
相关问题 更多 >
编程相关推荐