每次我尝试初始化一个 kivy 屏幕时,即使我已经研究过,我总是会收到一个错误,这表明我以正确的方式进行操作。我想从 my 访问实例,我 ProjectListScreen class将实例初始化为 None 但将屏幕初始化为 ApplyPage 不起作用,我尝试使用 Factory 将类实例化到 myApplyPage class 中,但它仍然没有返回实例的值。下面是我的代码,之后是我尝试初始化屏幕类时的回溯。我将不胜感激任何帮助。请我整天都在为此苦苦挣扎。
class ProjectListScreen(Screen):
project_list = ObjectProperty(None)
def __init__(self, **kwargs):
super(ProjectListScreen, self).__init__(**kwargs)
self.thelocalId = None
self.placementtext = None
def on_pre_enter(self, *args):
placements = database.child("placements").get()
placementslist = placements.val()
placementslist.items()
for key, value in placementslist.items():
self.key = key
key_list = []
key_list.append(key)
for key in key_list:
name = database.child("placements").child(str(key)).child("placement name").get()
description = database.child("placements").child(str(key)).child("placement description").get()
location = database.child("placements").child(str(key)).child("placement location").get()
date = database.child("placements").child(str(key)).child("placement date").get()
price = database.child("placements").child(str(key)).child("placement price").get()
thelocalId = database.child("placements").child(str(key)).child("localId").get()
self.thelocalId = thelocalId.val()
self.project_list.adapter.data.extend([ "\n" + "\n" + str(name.val()) + '\n' + str(description.val()) + "\n" + str(location.val()) + '\n' + str(date.val()) + '\n' + '\n' + str(price.val())])
def gettext(self):
self.placementtext = self.project_list.adapter.selection[0].text
class ApplyPage(Screen):
projectlistscreen = ObjectProperty(None)
倚天杖
慕后森
相关分类