我用Kivy创建了一个问题应用程序。我想在用户使用它时存储用户的答案。 例如。由用户1给出的答案,那么应该创建一个coloum作为user1,并且所有答案都存储为他们,如果user2使用app,则应该创建user2列,并且应该将所有答案存储为此类,等等。 我正在使用mongodb和pymongo
style.kv
<Screen1>:
name: "screen1"
FloatLayout:
Label:
text: "WHICH IS YOUR FAVORITE SWEET?"
pos_hint: {"top": 1.2}
font_size: 48
color: 1,1,1,1
Button:
on_release:
app.root.transition = SlideTransition(direction="left")
app.root.current = "screen2"
on_press: app.btn_pressed()
size_hint: 0.2, 0.8/3
pos_hint: {"center_x":0.2, "center_y":.4}
text: "HALDIRAMS \n KAJU KATHALI"
background_color: (0.0, 1.0, 1.0, 1.0)
font_size: 18
Button:
on_release:
app.root.transition = SlideTransition(direction="left")
app.root.current = "screen2"
on_press: app.btn_pressed()
size_hint: 0.2, 0.8/3
pos_hint: {"center_x":0.2, "center_y":.4}
text: "HALDIRAMS \n KAJU KATHALI"
background_color: (0.0, 1.0, 1.0, 1.0)
font_size: 18
Button:
on_release:
app.root.transition = SlideTransition(direction="left")
app.root.current = "screen2"
on_press: app.btn_pressed()
size_hint: 0.2, 0.8/3
pos_hint: {"center_x":0.4, "center_y":.4}
text: "HALDIRAMS \n SONPAPDI"
background_color: (1.0, 0.0, 0.0, 1.0)
font_size: 18
Button:
on_release:
app.root.transition = SlideTransition(direction="left")
app.root.current = "screen2"
size_hint: 0.2, 0.8/3
pos_hint: {"center_x":0.6, "center_y":.4}
text: "HALDIRAMS \n BADAM HALWA"
background_color: (1.0, 1.0, 0.0, 1.0)
font_size: 18
Button:
on_release:
app.root.transition = SlideTransition(direction="left")
app.root.current = "screen2"
size_hint: 0.2, 0.8/3
pos_hint: {"center_x":0.6, "center_y":.4}
text: "HALDIRAMS \n BADAM HALWA"
background_color: (1.0, 1.0, 0.0, 1.0)
font_size: 18
Button:
on_release:
app.root.transition = SlideTransition(direction="left")
app.root.current = "screen2"
on_press: app.btn_pressed()
size_hint: 0.2, 0.8/3
pos_hint: {"center_x":0.8, "center_y":.4}
text: "HALDIRAMS \n RASGULLA"
background_color: (0.8, 0.3, 0.4, 1.0)
font_size: 18