【发布时间】:2017-08-13 15:59:11
【问题描述】:
例如,我正在尝试使用 Kivy(1.9) 制作一个简单的 GUI,使用弹出窗口更改列表中的一些选项并将其保存到数据库中。当我调用 popup() 时,Python(3.4.5) 崩溃..
main.py:
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.popup import Popup
from kivy.properties import ListProperty
from kivy.lang import Builder
Builder.load_string('''
<PopView>:
title: 'Popup'
size_hint: (.8, .8)
Button:
text: 'Save'
''')
class MainApp(App):
def build(self):
b = Button(text='click to open popup')
b.bind(on_click=self.view_popup())
return b
def view_popup(self):
a=PopView()
a.data=[1,2,3,4] #e.g.
a.open()
class PopView(Popup):
def __init__(self):
self.data = ListProperty()
def save_data(self):
#db.query(self.data)
pass
if __name__ in ('__main__', '__android__'):
MainApp().run()
【问题讨论】:
标签: python python-3.x class popup kivy