当前位置: 首页>>代码示例>>Python>>正文


Python textinput.TextInput方法代码示例

本文整理汇总了Python中kivy.uix.textinput.TextInput方法的典型用法代码示例。如果您正苦于以下问题:Python textinput.TextInput方法的具体用法?Python textinput.TextInput怎么用?Python textinput.TextInput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kivy.uix.textinput的用法示例。


在下文中一共展示了textinput.TextInput方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from kivy.uix import textinput [as 别名]
# 或者: from kivy.uix.textinput import TextInput [as 别名]
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
					) 
开发者ID:the-duck,项目名称:launcher,代码行数:19,代码来源:main.py

示例2: setOptions

# 需要导入模块: from kivy.uix import textinput [as 别名]
# 或者: from kivy.uix.textinput import TextInput [as 别名]
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)) 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:11,代码来源:multi_input_box.py

示例3: __init__

# 需要导入模块: from kivy.uix import textinput [as 别名]
# 或者: from kivy.uix.textinput import TextInput [as 别名]
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))) 
开发者ID:HoussemCharf,项目名称:FunUtils,代码行数:12,代码来源:AndroidKivyApp_Letters2Words.py

示例4: __init__

# 需要导入模块: from kivy.uix import textinput [as 别名]
# 或者: from kivy.uix.textinput import TextInput [as 别名]
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) 
开发者ID:kpiorno,项目名称:kivy3dgui,代码行数:36,代码来源:tour3d.py

示例5: _create_popup

# 需要导入模块: from kivy.uix import textinput [as 别名]
# 或者: from kivy.uix.textinput import TextInput [as 别名]
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() 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:35,代码来源:settings.py

示例6: redraw

# 需要导入模块: from kivy.uix import textinput [as 别名]
# 或者: from kivy.uix.textinput import TextInput [as 别名]
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 
开发者ID:ODiogoSilva,项目名称:TriFusion,代码行数:32,代码来源:custom_widgets.py

示例7: __init__

# 需要导入模块: from kivy.uix import textinput [as 别名]
# 或者: from kivy.uix.textinput import TextInput [as 别名]
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) 
开发者ID:deepdiy,项目名称:deepdiy,代码行数:7,代码来源:text_viewer.py

示例8: _draw_form

# 需要导入模块: from kivy.uix import textinput [as 别名]
# 或者: from kivy.uix.textinput import TextInput [as 别名]
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) 
开发者ID:ntoll,项目名称:pypercard,代码行数:61,代码来源:core.py


注:本文中的kivy.uix.textinput.TextInput方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。