Python kivy.uix.textinput.TextInput() Examples

The following are 10 code examples of kivy.uix.textinput.TextInput(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module kivy.uix.textinput , or try the search function .
Example #1
Source File: main.py    From launcher with GNU General Public License v2.0 9 votes vote down vote up
def __init__(self, *args, **kwargs):
		super(AddBlockButton, self).__init__(*args, **kwargs)
		self.bind(on_release=self.openPopup)
		box=BoxLayout(padding=10)
		self.Input=TextInput(text="New Block", multiline=False, font_size=18)
		self.Input.bind(on_text_validate=self.addBlock)
		b=Button(text="Add it")
		b.bind(on_release=self.addBlock)	
		box.add_widget(self.Input)
		box.add_widget(b)
		self.addPopup = Popup(title="Add A New Block",
					size_hint=(None,None),
					size=(400,115),
					separator_color=[.9,.4,.2,1],
					background_color=[0,0,0,.6],
					content=box
					) 
Example #2
Source File: main.py    From launcher with GNU General Public License v2.0 7 votes vote down vote up
def __init__(self, *args, **kwargs):
		super(AddBlockButton, self).__init__(*args, **kwargs)
		self.bind(on_release=self.openPopup)
		box=BoxLayout(padding=10)
		self.Input=TextInput(text="New Block", multiline=False, font_size=18)
		self.Input.bind(on_text_validate=self.addBlock)
		b=Button(text="Add it")
		b.bind(on_release=self.addBlock)	
		box.add_widget(self.Input)
		box.add_widget(b)
		self.addPopup = Popup(title="Add A New Block",
					size_hint=(None,None),
					size=(400,115),
					separator_color=[.9,.4,.2,1],
					background_color=[0,0,0,.6],
					content=box
					) 
Example #3
Source File: multi_input_box.py    From kivy-smoothie-host with GNU General Public License v3.0 5 votes vote down vote up
def setOptions(self, options, callBack):
        self.optionCallBack = callBack
        self.contentButtons.clear_widgets()
        self.wl = []
        for name in options:
            self.contentButtons.add_widget(Label(text=name, size_hint_y=None, height='30dp', halign='right'))
            tw = TextInput(multiline=False, use_bubble=False, use_handles=False)
            self.contentButtons.add_widget(tw)
            self.wl.append((name, tw)) 
Example #4
Source File: AndroidKivyApp_Letters2Words.py    From FunUtils with MIT License 5 votes vote down vote up
def __init__(self,**kwargs):
		super(WordUI, self).__init__(**kwargs)
		self.cols=2
		#adding text label
		self.add_widget(Label(text="insert the words:"))
		#adding text Input
		self.letttersinput = TextInput(multiline=False)
		self.add_widget(self.letttersinput)
		#adding the action button
		self.add_widget(Button(text="Generate", on_press=self.game , pos=(50, 100))) 
Example #5
Source File: tour3d.py    From kivy3dgui with MIT License 5 votes vote down vote up
def __init__(self, **kwargs):
        wpos = self.pos = kwargs.pop("pos")
        try:
            self.create_image = kwargs.pop("create_image")
            super(Note, self).__init__(**kwargs)
        except:
            print(kwargs)         
        self.opacity = 0
        #Show
        anim = Animation(opacity=1.0, duration=0.3)
        anim.start(self)        
        create_image = kwargs.get('create_image', False)
                
        self.request_del = False
        text_editor = TextInput(size = (120, 90))
        close = Button(size = (20, 20), text="x")
        image = Image(source="./data/imgs/background.jpg", allow_stretch=True, keep_ratio=False)

        self.add_widget(image)
        self.add_widget(text_editor)
        self.add_widget(close)
        
        if create_image:         
            image_front = Image(source="./data/imgs/faust_github.jpg", size=(120,70), allow_stretch=True, keep_ratio=False)
            self.add_widget(image_front)

        self.size = (120, 120)
        self.size_hint = (None, None)
        image.size = (120, 120)
        text_editor.pos = (0, 10)
        close.pos = (100, 100)
        self.pos = wpos

        close.bind(on_release=self.close_request) 
Example #6
Source File: settings.py    From Tickeys-linux with MIT License 5 votes vote down vote up
def _create_popup(self, instance):
        # create popup layout
        content = BoxLayout(orientation='vertical', spacing='5dp')
        popup_width = min(0.95 * Window.width, dp(500))
        self.popup = popup = Popup(
            title=self.title, content=content, size_hint=(None, None),
            size=(popup_width, '250dp'))

        # create the textinput used for numeric input
        self.textinput = textinput = TextInput(
            text=self.value, font_size='24sp', multiline=False,
            size_hint_y=None, height='42sp')
        textinput.bind(on_text_validate=self._validate)
        self.textinput = textinput

        # construct the content, widget are used as a spacer
        content.add_widget(Widget())
        content.add_widget(textinput)
        content.add_widget(Widget())
        content.add_widget(SettingSpacer())

        # 2 buttons are created for accept or cancel the current value
        btnlayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp')
        btn = Button(text='Ok')
        btn.bind(on_release=self._validate)
        btnlayout.add_widget(btn)
        btn = Button(text='Cancel')
        btn.bind(on_release=self._dismiss)
        btnlayout.add_widget(btn)
        content.add_widget(btnlayout)

        # all done, open the popup !
        popup.open() 
Example #7
Source File: settings.py    From Tickeys-linux with MIT License 5 votes vote down vote up
def _create_popup(self, instance):
        # create popup layout
        content = BoxLayout(orientation='vertical', spacing='5dp')
        popup_width = min(0.95 * Window.width, dp(500))
        self.popup = popup = Popup(
            title=self.title, content=content, size_hint=(None, None),
            size=(popup_width, '250dp'))

        # create the textinput used for numeric input
        self.textinput = textinput = TextInput(
            text=self.value, font_size='24sp', multiline=False,
            size_hint_y=None, height='42sp')
        textinput.bind(on_text_validate=self._validate)
        self.textinput = textinput

        # construct the content, widget are used as a spacer
        content.add_widget(Widget())
        content.add_widget(textinput)
        content.add_widget(Widget())
        content.add_widget(SettingSpacer())

        # 2 buttons are created for accept or cancel the current value
        btnlayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp')
        btn = Button(text='Ok')
        btn.bind(on_release=self._validate)
        btnlayout.add_widget(btn)
        btn = Button(text='Cancel')
        btn.bind(on_release=self._dismiss)
        btnlayout.add_widget(btn)
        content.add_widget(btnlayout)

        # all done, open the popup !
        popup.open() 
Example #8
Source File: custom_widgets.py    From TriFusion with GNU General Public License v3.0 5 votes vote down vote up
def redraw(self):
        """
        Note: This methods depends on internal variables of its TextInput
        base class (_lines_rects and _refresh_text())
        """

        self._refresh_text(self.text)

        max_size = max(self._lines_rects, key=lambda r: r.size[0]).size
        num_lines = len(self._lines_rects)

        px = [self.DEFAULT_PADDING, self.DEFAULT_PADDING]
        py = [self.DEFAULT_PADDING, self.DEFAULT_PADDING]

        if self.halign == 'center':
            d = (self.width - max_size[0]) / 2.0 - self.DEFAULT_PADDING
            px = [d * 1.1, d]
        elif self.halign == 'right':
            px[0] = self.width - max_size[0] - self.DEFAULT_PADDING

        if self.valign == 'middle':
            d = (self.height - max_size[1] * num_lines) / \
                2.0 - self.DEFAULT_PADDING
            py = [d * 1.1, d]
        elif self.valign == 'bottom':
            py[0] = self.height - max_size[1] * num_lines - \
                    self.DEFAULT_PADDING

        self.padding_x = px
        self.padding_y = py 
Example #9
Source File: text_viewer.py    From deepdiy with MIT License 5 votes vote down vote up
def __init__(self):
		super(TextViewer, self).__init__()
		self.text_input=TextInput(id='text_area',readonly=True)
		self.add_widget(self.text_input)
		self.bind(data=self.refresh) 
Example #10
Source File: core.py    From pypercard with MIT License 4 votes vote down vote up
def _draw_form(self):
        """
        Encompasses the drawing of a form with a textual label onto the card.
        """
        inner_layout = BoxLayout(orientation="vertical")
        label_layout = BoxLayout(orientation="vertical", size_hint=(1, 0.2))
        self.form_label = Label(
            text=self.text, font_size=self.font_size, markup=True
        )
        self.form_label.color = list(self.text_color)
        self.form_label.valign = "top"
        self.form_label.halign = "left"
        label_layout.add_widget(self.form_label)
        form_layout = BoxLayout(orientation="vertical")
        form_layout.padding = 10
        filler = None
        if self.form == Inputs.TEXTBOX:
            self.textbox = TextInput(text="", multiline=False)
            self.textbox.font_size = self.font_size
            form_layout.size_hint = (1, 0.2)
            form_layout.add_widget(self.textbox)
            filler = BoxLayout(orientation="vertical", size_hint=(1, 0.6))
        elif self.form == Inputs.TEXTAREA:
            self.textarea = TextInput(text="")
            self.textarea.font_size = self.font_size
            form_layout.add_widget(self.textarea)
        elif self.form == Inputs.MULTICHOICE:
            self.multichoice = []
            for item in self.options:
                button = ToggleButton(text=item)
                button.font_size = self.font_size
                form_layout.add_widget(button)
                self.multichoice.append(button)
        elif self.form == Inputs.SELECT:
            self.select = []
            for item in self.options:
                button = ToggleButton(text=item, group=self.title)
                button.font_size = self.font_size
                form_layout.add_widget(button)
                self.select.append(button)
        elif self.form == Inputs.SLIDER:
            min_val = self.options[0]
            max_val = self.options[1]
            if len(self.options) == 3:
                step = self.options[2]
            else:
                step = 1
            self.slider = Slider(
                value_track=True, min=min_val, max=max_val, step=step
            )
            self.slider_label = Label(text="0", font_size=64)
            self.slider.bind(value=self._slider_change)
            form_layout.add_widget(self.slider)
            form_layout.add_widget(self.slider_label)
        inner_layout.add_widget(label_layout)
        inner_layout.add_widget(form_layout)
        if filler:
            inner_layout.add_widget(filler)
        self.layout.add_widget(inner_layout)