1
kivyで一度に1文字ずつ文字列を表示したかったのです。私はこれをやろうとしましたが、完了したら文字列全体(一度に1文字ではない)だけを表示します。kivyを使用して一度に1つの文字列を印刷するにはどうすればいいですか?
from kivy.app import App
from kivy.uix.textinput import TextInput
from kivy.uix.label import Label
from kivy.uix.boxlayout import BoxLayout
from time import sleep
class someclass(BoxLayout):
def __init__(self):
super(someclass, self).__init__()
l = Label(text= '',size_hint_y= 0, height='40dp', pos_hint={'x':0, 'y':0.5})
self.add_widget(l)
s = 'Hello hello hello hello'
for c in s:
sleep(0.5)
l.text += c
class TestApp(App):
def build(self):
return someclass()
TestApp().run()