【发布时间】:2022-09-28 05:17:13
【问题描述】:
我在 kivy MD 中创建了一个对话框,并在其中放置了一个 MDTextField。然后,我尝试更改line_color_normal 属性以使文本字段看起来更酷,但这不起作用。
class MyProgramApp(MDApp):
def pop_dialog(self, *args):
input_box = BoxLayout(orientation=\'vertical\', size_hint_y=None,
height=100)
self.text = MDTextField(hint_text=\'Name\',
size_hint_x=0.9, color_mode=\'custom\', line_color_normal=(1, 0, 0, 1))
input_box.add_widget(self.text)
self.dialog = MDDialog(title=\'Create\', type=\'custom\',
content_cls=input_box)
self.dialog.open()
我看过documentation,但没有帮助。
-
首先将
color_mode设置为\'custom\'。 -
我实际上是这样做的,但它引发了一个错误:
ValueError: None is not allowed for MDTextField._current_line_color
标签: python input dialog kivymd