我是新奇的。
我最近做了第一个简单的应用程序。从各种在线文档中,我注意到有一个命令总是根据开发人员的解释而有所不同。我举一个简单的例子:
class ShowApp(thisParameterWillCompletelyChangeYourLife):
def __init__(self, **kwargs):
super(ShowApp, self).__init__(**kwargs)
def listenerOfAButton(self):
print("Reconized...")
def listenerOfAnotherButton(self):
print("Reconized it also...")
class myApp(App):
def build(self):
return ShowApp()
if __name__ == "__main__":
myApp().run()
kv示例文件:
<ShowApp>:
Label:
id: labelIdentifier
text: "Hello World"
我想知道...无论 ShowApp 类的名称必须等于kv文件中的<ShowApp>
,该参数必须传递给采用关心生成kv文件中包含的所有布局?
在我的示例中,我将其命名为 thisParameterWillCompletelyChangeYourLife ,而就此输入而言,我还不了解到目前为止阅读的有关kivy的文档的意愿。
有人可以向我解释在构建阶段应将哪些参数传递给生成“ app”的功能(及其用途)吗?
提前非常感谢!
答案 0 :(得分:0)
您所称的data_line=open("file1.txt", mode="r")
lines=[]
for line in data_line:
lines.append(line)
for i, line in enumerate(lines):
# print('{}={}'.format(i+1, line.strip()))
file1_header=lines[0]
num_line=1
Dictionary_File1={}
Value_File1= data_type[0:6]
Value_File1_short=[]
i=1
for element in Value_File1:
type=element.split(',')
Value_File1_short.append(type[0] + ", " + type[1] + ", " + type[4])
i += 1
Dictionary_File1[ file1_header]=Value_File1_short
pd_file1=pd.DataFrame.from_dict(Dictionary_File1)
是thisParameterWillCompletelyChangeYourLife
类的基类。它不是要传递的参数。它可以是任何类,也可以是任何类。在您使用时,它可能是ShowApp
或Widget
类。如所写,您的Layout
试图扩展名为ShowApp
的类。
看到这个documentation