kivy

How to set kivy widget id from Python code file

孤街醉人 提交于 2021-01-27 18:47:41
问题 I need help assigning ids to new kivy widgets that are created from a python function I've tried : old = Label(id = 'old') and : old = Label() old.id = 'old' but it doesn't seem to work because, whenever i try referencing the widgets, it gives me an error 回答1: The ways that you have creating id in Python code are correct. But you cannot reference them using self.ids.old or self.ids['old'] because they don't exist in self.ids . The self.ids dictionary type property contains only all widgets

Kivy TextInput with autocomplete

二次信任 提交于 2021-01-27 17:22:59
问题 I am new to kivy. I want to know if there is a way to create a textinput with autocomplete functionality, that lets you select from a dictionary with 200 items. Similar to the select2 that you have in HTML/CSS 回答1: You can implement it yourself, just bind the on_text event and change the suggestion_text property. you may also check for TAB key press event to know when to change the text to the suggested completion. 来源: https://stackoverflow.com/questions/40066446/kivy-textinput-with

Is there a way to show a number pad (preferably with a bubble) in a TextInput field using Kivy and Python? NEW ISSUE WITH CODE

我的梦境 提交于 2021-01-27 16:18:24
问题 I have an app where you input numbers (a lot) and it gets hard that the keyboard is also letters, I would like it to be just numbers (0-9), and a dot. Is there any way to do this using Kivy's .kv file and Python? I have tried input_type: 'number' in the .kv file, but I couldn't get it to work. Thanks! Edit: I have also tried using bubbles, no luck. Although, it would be nice to have a bubble number pad if possible. Edit 2: I have put another bounty on this question because when I put the

Is there a way to show a number pad (preferably with a bubble) in a TextInput field using Kivy and Python? NEW ISSUE WITH CODE

陌路散爱 提交于 2021-01-27 16:16:18
问题 I have an app where you input numbers (a lot) and it gets hard that the keyboard is also letters, I would like it to be just numbers (0-9), and a dot. Is there any way to do this using Kivy's .kv file and Python? I have tried input_type: 'number' in the .kv file, but I couldn't get it to work. Thanks! Edit: I have also tried using bubbles, no luck. Although, it would be nice to have a bubble number pad if possible. Edit 2: I have put another bounty on this question because when I put the

Kivy-how can i make my canvas height smaller than the parent height

我怕爱的太早我们不能终老 提交于 2021-01-27 12:28:13
问题 I have a stacklayout with a canvas and an image. my image has a size_hint of .1 and I want my canvas to have the same height as my image. .kv file: StackLayout: orientation: 'lr-tb' canvas: Color: rgba: 1,1,1,1 Rectangle: pos: self.pos size: self.size Image: size_hint_y: .1 source: 'Images\login\cptbanner.jpg' allow_stretch: True keep_ratio: True what can I do to get the desired effect? 回答1: A Kivy canvas is not a widget or the space in which you paint. It is only a set of instructions. You

python kivy add text inside rectangle

守給你的承諾、 提交于 2021-01-27 12:11:05
问题 How can I add text inside a rectangle? I am using the code below and added a label inside the canvas hoping that it will display inside the rectangle. import kivy from kivy.app import App from kivy.uix.anchorlayout import AnchorLayout from kivy.uix.gridlayout import GridLayout from kivy.uix.label import Label from kivy.uix.video import Video from kivy.uix.relativelayout import RelativeLayout from kivy.graphics import * class MyApp(App): def build(self): r = AnchorLayout() f = RelativeLayout()

AttributeError: 'super' object has no attribute '__getattr__' Error when using BoxLayout with several kv-files in Kivy

这一生的挚爱 提交于 2021-01-27 11:33:30
问题 As I am very well aware, this question has been asked several times already. But after trying the following solutions: Python - Kivy: AttributeError: 'super' object has no attribute '__getattr__' when trying to get self.ids Python/Kivy AttributeError: 'super' object has no attribute '__getattr__' How can i access object properties of another class in kivy without getting AttributeError: 'super' object has no attribute '__getattr__' AttributeError: 'super' object has no attribute '__getattr__'

AttributeError: 'super' object has no attribute '__getattr__' Error when using BoxLayout with several kv-files in Kivy

泄露秘密 提交于 2021-01-27 11:32:28
问题 As I am very well aware, this question has been asked several times already. But after trying the following solutions: Python - Kivy: AttributeError: 'super' object has no attribute '__getattr__' when trying to get self.ids Python/Kivy AttributeError: 'super' object has no attribute '__getattr__' How can i access object properties of another class in kivy without getting AttributeError: 'super' object has no attribute '__getattr__' AttributeError: 'super' object has no attribute '__getattr__'

AttributeError: 'super' object has no attribute '__getattr__' Error when using BoxLayout with several kv-files in Kivy

不羁的心 提交于 2021-01-27 11:32:16
问题 As I am very well aware, this question has been asked several times already. But after trying the following solutions: Python - Kivy: AttributeError: 'super' object has no attribute '__getattr__' when trying to get self.ids Python/Kivy AttributeError: 'super' object has no attribute '__getattr__' How can i access object properties of another class in kivy without getting AttributeError: 'super' object has no attribute '__getattr__' AttributeError: 'super' object has no attribute '__getattr__'

Dynamically resizing a kivy label (and button) on the python side

梦想与她 提交于 2021-01-27 06:20:44
问题 How do I dynamically resize the a label or button, in particular, the text_size and height, depending on the amount of text, at run-time? I am aware that this question has already been answered in one way with this question: Dynamically resizing a Label within a Scrollview? And I reflect that example in part of my code. The problem is dynamically resizing the labels and buttons at run-time. Using, for example: btn = Button(text_size=(self.width, self.height), text='blah blah') ...and so on,