kivy-language

kivy: “Invalid property name” error message for a valid property name

我的未来我决定 提交于 2019-12-12 04:46:38
问题 If I put this into the main program: class MyTextInput(TextInput): def on_focus(self, *args, **kwargs): print("Yay!", args, kwargs) And this into the kv file: #: import MyTextInput __main__.MyTextInput MyTextInput: id: e_birth_date text: "" size_hint_x: 1 Then the behaviour is correct, this is printed whenever the text input gets or looses the focus: Yay! (<__main__.MyTextInput object at 0x0CC1B8B8>, True) {} Yay! (<__main__.MyTextInput object at 0x0CC1B8B8>, False) {} However, this does not

Changing background color in kivy [duplicate]

拈花ヽ惹草 提交于 2019-12-12 04:34:47
问题 This question already has an answer here : kivy: change background color to white (1 answer) Closed 2 years ago . I would like to change the background (black color) to a different color in kivy. But the Color specification in kv file is not recognized. main.py from kivy.app import App from kivy.uix.boxlayout import BoxLayout from kivy.lang import Builder class MatrixCalcLayout(BoxLayout): def calculations(self): pass class ConfusionMatrixCalcApp(App): pass if __name__ == '__main__':

Accessing id/widget of different class from a kivy file (.kv) using Kivy's clock?

痴心易碎 提交于 2019-12-12 04:04:24
问题 I've spent the day working with the code from How to access id/widget of different class from a kivy file (.kv)? I've paired it down to the simplest code I could because what I want to do is use Kivy's Clock function to change the text for me instead of clicking the button. As best as I can understand the code that changes the text should go on Line 38 of the program but all the code I tried stopped executing because it could not access the text to change it. The clock function is working in

Forcing a Kivy widget's orientation to be landscape/portrait

笑着哭i 提交于 2019-12-12 03:29:13
问题 I'm developing an app where I want one of ScreenManager's screen to be in landscape orientation. I don't want it to change to vertical by itself. As of now, what I learned is only buildozer.spec file can change the app's orientation. What I want is to change the widget's orientation. Is there any way to do this? 回答1: You can place a content of the screen on a scatter layout, and then rotate it: test.kv: ScreenManager: Screen: name: 'normal' Grid Screen: name: 'flipped' ScatterLayout: do

Return from canvas.get_group() call in kivy

Deadly 提交于 2019-12-12 02:45:42
问题 Calling get_group() from an instruction group yields back more that what I wanted. I have the following code: for widget in self.selected: dx, dy = ( widget.pos[0] - self.pos[0], widget.pos[1] - self.pos[1] ) self.shadows.add(Rectangle(size=widget.size, pos=widget.pos, group='my_shadows')) self.canvas.add(self.shadows) print self.shadows.get_group('my_shadows') which in turn produces the following result: <kivy.graphics.context_instructions.BindTexture object at 0x7ff992377050> <kivy.graphics

kivy - I want to change an attribute of a widget in a screen out of a popup

淺唱寂寞╮ 提交于 2019-12-12 01:46:45
问题 I want to change the color of an image. This image is placed on an button on a screen with screenmanager. When I push the button a popup appears to choose a color. This color should now be saved in a global variable and set as color for the (former white) image. My problem is, i cant access the property of the image from the class of the popup. The relevant part of the .kv: <HomeScreen>: sm: sm name: 'ScreenManager' BoxLayout: orientation: 'vertical' rows: 2 ActionBar: [...] ScreenManager: id

AttributeError: 'super' object has no attribute '__getattr__'

[亡魂溺海] 提交于 2019-12-11 23:48:02
问题 I've been searching for the solution of this problem over the all internet but I still can't find the right solution. There are lots of generic answers but none of those have solved my problem.. I am trying to build a simple CLOCK app with kivy and python 3.6.4 but every time I run the main.py I get this error: AttributeError: 'super' object has no attribute ' getattr ' MY MAIN "main.py" FILE IS THIS: from kivy.app import App from kivy.clock import Clock from kivy.core.text import LabelBase

Kivy App loads with other colors than defaults every launch (bug)

会有一股神秘感。 提交于 2019-12-11 17:57:41
问题 (Python 3.7.3 / Kivy 1.10.1 / Win10 patch 1809) Hi, thanks for taking some time to read me. I'm having an issue with Kivy loading my app's text with different colors than the default ones. The said text should be white (default color), but sometimes randomly appears grey, or almost black when I close then relaunch the app. I didn't have this issue yesterday, it has started to happen today. Here are screenshots of different attempts to run mytest.py , I didn't do anything more than closing and

How do you create a Matplotlib widget in Kivy kv file?

百般思念 提交于 2019-12-11 17:13:14
问题 I want to use a .kv file to make a Matplotlib widget, but I'm not sure how to do this. Without a .kv file, the basic code looks like this: from kivy.garden.matplotlib.backend_kivyagg import FigureCanvasKivyAgg from kivy.app import App from kivy.uix.boxlayout import BoxLayout import matplotlib.pyplot as plt plt.plot([1, 23, 2, 4]) plt.ylabel('some numbers') class MyApp(App): def build(self): box = BoxLayout() box.add_widget(FigureCanvasKivyAgg(plt.gcf())) return box MyApp().run() How is this

kivy scrollview is not working

瘦欲@ 提交于 2019-12-11 16:57:18
问题 I am trying to use kivy scrollview inside of EmployeeScreen class. it will not scroll!? what am I doing wrong? I hope this is not a duplicate, please help. I went to this link Kivy ScrollView - Not Scrolling. which seems to be the only question relating to kivy scrollview not scrolling. this didn't solve my problem. .py file: `from kivy.app import App from kivy.uix.label import Label from kivy.uix.button import Button from kivy.uix.screenmanager import ScreenManager, Screen from kivy