1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > python 从def里面调用另一个def函数内容_在python中从一个类调用def到另一个类

python 从def里面调用另一个def函数内容_在python中从一个类调用def到另一个类

时间:2019-05-24 18:21:14

相关推荐

python 从def里面调用另一个def函数内容_在python中从一个类调用def到另一个类

我有两个文件demo.py和demo.kv。

有人能告诉我如何从一个类调用函数到另一个类吗?我想从def on_text(self, text_input, value):调用def calculate(self):,现在我正在使用代码def on_text(self, text_input, value):

App.get_running_app().User.calculate()

但它给出错误AttributeError:“Test”对象没有属性“User”

在py演示在

^{pr2}$

在演示电压在:

size_hint_y: None

height: self.minimum_height

height: 40

Button:

text: root.button_text

size_hint_x: None

top: 200

TextInput:

text: root.col_data3

width: 300

TextInput:

id: number_input

text: root.col_data4

width: 300

input_filter: 'int'

:

size_hint_y: None

height: self.minimum_height

orientation: "vertical"

:

id: user

total_value:total_value

BoxLayout:

orientation: "vertical"

padding : 20, 5

BoxLayout:

orientation: "horizontal"

#padding : 10, 10

spacing: 10, 10

size: 450, 40

size_hint: None, None

Label:

size_hint_x: .2

text: "Number"

text_size: self.size

valign: 'bottom'

halign: 'center'

Label:

size_hint_x: .4

text: "name"

text_size: self.size

valign: 'bottom'

halign: 'center'

Label:

size_hint_x: .4

text: "Value"

text_size: self.size

valign: 'bottom'

halign: 'center'

ScrollView:

Rows:

id: rows

BoxLayout:

orientation: "horizontal"

padding : 10, 5

spacing: 10, 10

size: 200, 40

size_hint: None, None

Label:

size_hint_x: .7

text: "Total value"

TextInput:

id: total_value

on_focus:root.test()

BoxLayout:

orientation: "horizontal"

size_hint_x: .2

size_hint_y: .2

Button:

text: "+Add More"

on_press: root.add_more()

:

BoxLayout:

orientation: "vertical"

Button:

size_hint: .25, .03

text: "+Add"

on_press: root.add()

GridLayout:

size_hint: 1, None

size_hint_y: None

height: 25

cols: 3

BoxLayout:

orientation: "vertical"

:

text_size: self.size

valign: "middle"

padding_x: 5

size : (100, 40)

size_hint : (None, None)

background_color: 90 , 90, 90, 90

background_normal: ''

color: 0, 0.517, 0.705, 1

border: (0, 10, 0, 0)

:

content_area: content_area

BoxLayout:

orientation: 'vertical'

spacing : 10

BoxLayout:

canvas.before:

Rectangle:

pos: self.pos

size: self.size

size_hint_y: 2

MenuButton:

text: 'Menu'

size : (50, 12)

on_release: root.display()

BoxLayout:

id: content_area

size_hint_y: 30

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。