我犯了一个错误
NameError: name 'Factory' is not defined
当我尝试导入kv文件中的工厂时。但我已经在py文件中导入了
下面是我的代码
Kv文件:
<MessagePopup>:
id: popup
auto_dismiss: False
title: "User Verification"
size_hint: None, None
size: 300,300
space_x: self.size[0]/6
space_y: self.size[1]/6
BoxLayout:
orientation: "vertical"
spacing: 20
padding: popup.space_x, popup.space_y
Label:
text: "Click to verify"
Button:
id:popup_phone
text:"Verify"
size_hint_y: 5.5
on_release:
Factory.PhonePopup().open()
<PhonePopup@Popup>:
id: "Phno_popup"
title: "Verify"
size_hint: None, None
size: 300,300
space_x: self.size[0]/6
space_y: self.size[1]/6
BoxLayout:
orientation: "vertical"
spacing: 20
padding: Phno_popup.space_x, Phno_popup.space_y
Label:
text:"Enter"
size_hint_y: 5.5
TextInput:
id: id_phno
size_hint_y: 5.5
multiline: False
Button:
text: "Verify"
size_hint_y: 5.5
on_press: root.id_verify()
Py文件:
import mysql.connector
from kivy.app import App
from kivy.config import Config
from kivy.properties import ObjectProperty
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.label import Label
from kivy.uix.popup import Popup
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.textinput import TextInput
from kivy.factory import Factory
我是基维的初学者
您还需要以千伏为单位导入工厂。
将以下行添加到
.kv
文件的顶部:相关问题 更多 >
编程相关推荐