python读取文件选择器中的文件_如何从弹出文件选择器获取值?

我从下面的链接中找到了一个弹出文件选择器:

我无法获取要在应用程序的main Tab()类实例和类FileChoosePopup popup实例之间传递的文件路径字符串值。我知道这个问题以前有人问过,但我似乎想不通。当我运行应用程序并单击要传递给主类上的TextInput的文件时,我得到以下错误:AttributeError: 'super' object has no attribute '__getattr__'

我尝试过使用super init方法在main类中传递对popup类实例的引用,但是应用程序甚至没有初始化。在

这是我在python中弹出的窗口:

^{pr2}$

这里是kivy代码::

title: "Choose a .CSV File"

size_hint: .9, .9

auto_dismiss: False

BoxLayout:

orientation: "vertical"

FileChooser:

id: filechooser

FileChooserIconLayout

BoxLayout:

size_hint: (1, 0.1)

pos_hint: {'center_x': .5, 'center_y': .5}

spacing: 20

RoundedCancelButton:

text: "Cancel"

on_release: root.dismiss()

RoundedAcceptButton:

text: "Load"

on_release: root.load(filechooser.selection)

id: ldbtn

disabled: True if filechooser.selection==[] else False

:

TabbedPanel:

do_defualt_tab: False

background_color: (.87, .87, .87, 1)

border: [0, 0, 0, 0]

background_image: 'path/to/background/image'

TabbedPanelItem:

text: 'Import'

background_color: (1, .5, 0, 1)

background_normal: ''

StackLayout:

orientation: 'lr-tb'

size_hint_y: None

height: 30

spacing: 5

Label:

text: ''

size_hint_x: 1

Label:

text: ''

size_hint_x: 0.2

RoundedButton:

text: 'Choose File'

size_hint_x: 0.2

on_press: root.open_popup()

TextInput:

id: get_file

readonly: True

size_hint_x: 0.4

Label:

text: ''

size_hint_x: 0.2

有人能给我一些关于如何让值从弹出窗口传递到textinput的提示吗?在

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值