【问题标题】:How to add line numbers in Kivy TEXTINPUT without .kv file?如何在没有 .kv 文件的情况下在 Kivy TEXTINPUT 中添加行号?
【发布时间】:2021-05-02 05:54:06
【问题描述】:

我正在尝试为 android 创建一个简单的记事本。如何将行号添加到 Kivy 的 TextInput()?我的代码是

from kivy.app import App

from kivy.uix.textinput import TextInput
from kivy.uix.boxlayout import BoxLayout

class Text(TextInput):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.hint_text = "Your text here"

class NotePad(App):
    def build(self):
        box = BoxLayout()
        text = Text()
        box.add_widget(text)
        return box

我想添加行号。我该怎么做?

【问题讨论】:

    标签: python kivy textinput line-numbers


    【解决方案1】:

    也许这对你有帮助:https://github.com/griloHBG/TextInputLineNumber

    它使用 KV 语言(非常好),但可以用作基础来开发仅 python 的东西。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-06-15
      • 2016-12-28
      • 2020-09-12
      • 2021-05-05
      相关资源
      最近更新 更多