Python / Kivy:将变量从一个类传递给另一个类

时间:2017-12-01 11:04:32

标签: python python-3.x python-2.7 kivy kivy-language

我有一个类GroupScreen,其变量self.abc = 10然后如何在TreeviewGroup类中获取此变量值并传入此查询cur.execute("SELECT * FROM test {{1} } ID为WHERE

=?", (abc,))

1 个答案:

答案 0 :(得分:2)

abc添加到__init__应该有效:

class TreeviewGroup(Popup):
    treeview = ObjectProperty(None)
    tv = ObjectProperty(None)

    def __init__(self, abc, **kwargs): # note the `abc`
        ...