kivy-language

Kivy behavior of drawing in canvas, to change it's background

自闭症网瘾萝莉.ら 提交于 2019-12-11 05:18:06
问题 I'm trying to set the background of my layout with the following kv language: <RootWidget>: Menu: orientation: 'vertical' Button: text: 'btn1' on_release: print('btn1') Button: text: 'btn' on_release: print('btn2') BoxLayout: BoxLayout: canvas.before: Rectangle: pos: self.pos size: self.size source: 'main_background.png' ToggleMenuButton: on_release: root.toggle_state() size_hint: None, None size: 60, 60 background_color: 0, 0, 0, 0 Image: size: self.parent.size pos: self.parent.pos allow

Kivy Camera as KV language widget

丶灬走出姿态 提交于 2019-12-11 04:26:06
问题 I am using Kivy with a webcam. I have followed this example by @Arnav of using opencv to form and display the camera as a widget. I have "extended" the layout within python it to add two buttons as a test, in preparation for a more complicated layout. class CamApp(App): def build(self): self.capture = cv2.VideoCapture(0) self.my_camera = KivyCamera(capture=self.capture, fps=30,resolution=(1920,1080)) root = BoxLayout(orientation = 'vertical') root.add_widget(self.my_camera,1) box2 = BoxLayout

How to change a space when a button is pressed with kivy?

巧了我就是萌 提交于 2019-12-11 04:15:37
问题 I am trying create a GUI by implementing the template of the ComicCreator GUI sample as a template for my own project. The code is easy to follow, but I would like to be able to reconfigure the drawingspace.kv , each time a button is pushed, say for example something like this: Q: How could I configure the drawingspace.kv to have a different layout with different widgets for each button that is pressed? 回答1: A neat way to do this is to use screen. Since I allready have an example of this app

Kivy: Popup can have only one widget as content

你说的曾经没有我的故事 提交于 2019-12-11 03:55:32
问题 I am having an issue with using a popup in my .kv file. I understand that a popup can only have one widget as it's content, however if I am only passing a GridLayout as a child that includes a Label and Button, shouldn't this work? Here is my Python code: import kivy, LabelB from kivy.app import App from kivy.graphics import Color, Rectangle from kivy.uix.boxlayout import BoxLayout from kivy.uix.floatlayout import FloatLayout from kivy.uix.gridlayout import GridLayout from kivy.uix

Stopping a kivy video

会有一股神秘感。 提交于 2019-12-11 03:23:46
问题 I want to stop this kivy video on tap event(play by default). I'm running this on the raspberry PI. Here's my kv and python code. <VideoScreen>: name: 'Video' BoxLayout: Video: id: 'video1' source: './media/Sequence_#1.mp4' state: root.current_video_state volume: 1 options: {'eos': 'loop'} allow_stretch: True The video is played in loops and on tap it switches to new screen 'Login' but the video doesn't stops and is still playing in loops(I want to stop this after new screen is loaded). There

Accessing value of child widget property in kivy lang and python

感情迁移 提交于 2019-12-10 22:22:35
问题 How can I overwrite the default value of a Kivy widget's child? i.e. MyWidget.label is 'default' but I want to change it to e.g. 'purple turtle' when a child of MyRootWidget ? I can access the children of children as I've done in MyRootWidget.__init__() , but it seems cumbersome, especially for a deep tree ... is there a more elegant way of doing it? I've been looking over the Kivy lang and Widget pages, but haven't been able to understand a solution if it's there. I haven't seen quite this

get value of selected checkbox in kivy

烂漫一生 提交于 2019-12-10 11:35:46
问题 test.py import sqlite3 as lite from kivy.uix.screenmanager import Screen from kivy.app import App from kivy.lang import Builder from kivy.core.window import Window Window.size = (600, 325) class UserGroup(Screen): def insert_data(self, arg1,arg2): print(arg1) print(arg2) class FactUserGroup(App): def build(self): self.root = Builder.load_file('test.kv') return self.root if __name__ == '__main__': FactUserGroup().run() test.kv <CustomLabel@Label>: text_size: self.size valign: "middle" padding

Python kivy - how to reduce height of TextInput

女生的网名这么多〃 提交于 2019-12-10 11:28:08
问题 I am using kivy to make a very simple gui for an application. Nothing complex, very simple layout. Nevertheless I am having a hard time with TextInputs...They always display with full height and I can't manage to make them adjust to a "reasonable" text-height like height. I am using the kv files style since I find it cleaner and easier to integrate it in an already existing app...I would like to reduce as much as possible the gui-python code of the app. Here is what I got for the TextInput

Calling Function in a Different Class Through Kivy Button

筅森魡賤 提交于 2019-12-10 10:48:06
问题 I am trying to call a function on button press in kivy, that is located in a different class screen than the button is located in. I tried running the function in the app class as well and ran into issues there. Here is the class where the function I am trying to call lies: # Main screen with button layout class LandingScreen(Screen): def __init__(self, **kwargs): super(LandingScreen, self).__init__(**kwargs) self.buttons = [] # add references to all buttons here Clock.schedule_once(self.

creating a main menu for a mobile app in python

旧巷老猫 提交于 2019-12-08 13:58:08
问题 I'm have trouble figuring out how to begin a code that displays a main menu. I want this main menu to display 5 different options that when on of them is clicked, it open that page/option. I also have Kivy installed, and the overall goal is to make a mobile app. My python experience is low, so I haven't actually written out any code for this goal but I have a full layout of what I want the app to look like. Updated: This is what I have so far. mainMenu = {} mainMenu ['1'] = 'Option 1'