from kivy.uix.label import Label from kivy.core.window import Window class Command_prompt(Label): def __init__(self,app,**kwargs): # app is used to share information between widgets self.app=app # insert mode self.insert=False # init Label super(Command_prompt,self).__init__(**kwargs) self.keyboard = Window.request_keyboard(None,self,"text") self.keyboard.bind(on_textinput=self.on_textinput,on_key_down=self.on_key_down) def on_key_down(self, keyboard, keycode, text, modifiers): if self.insert: if keycode[1]=="enter": self.insert=False self.text="" def on_textinput(self,window,text): if self.insert: self.text+=text elif text==':': self.text+=text self.insert=True