kivy | Open source UI framework written in Python | iOS library
kandi X-RAY | kivy Summary
kandi X-RAY | kivy Summary
Open source UI framework written in Python, running on Windows, Linux, macOS, Android and iOS
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Dispatch a node .
- Shorten the post text .
- Layout hint_hint
- Indent the continuation line .
- helper function to apply a rule
- Filter the parameters .
- Parse a list of objects .
- Called when a touch is started .
- Iterate layout .
- Fetch the current URL
kivy Key Features
kivy Examples and Code Snippets
p4a apk --private $HOME/code/myapp --package=org.example.myapp --name "My application" --version 0.1 --bootstrap=sdl2 --requirements=python3,kivy
from kivy.app import App
from kivy.lang import Builder
from kivy.core.window import Window
kv = '''
GridLayout:
cols: 1
size_hint: (0.7, 0.9)
pos_hint: {"center_x": 0.5, "center_y": 0.5}
Image:
source: 'captus
class MainScreenManager(ScreenManager):
def on_kv_post(self, base_widget):
if not SHOW_SPLASH_SCREEN:
self.transition = NoTransition()
self.current = 'screen_main'
self.transition = FadeTran
import #what u need
Builder.load_file('the.kv')
class fscreen(Widget):
def __init__(self, **kwargs):
super().__init__(**kwargs)
class secscreen(Widget):
def __init__(self,**kwargs):
super().__ini
Clock.schedule_once(switch_to_main_screen, 3)
Clock.schedule_once(lambda dt: setattr(self, 'current', 'main_screen'), 3)
INITIAL_BOUNDED_VALUE = 20
class test(ScreenManager):
value = BoundedNumericProperty(testvars.INITIAL_BOUNDED_VALUE, min = 0, max = 24)
from kivy.event import EventDispatcher
from kivy.
MainApp().update_lbl()
App.get_running_app().update_lbl()
class Main(Screen):
transport_price_value = NumericProperty(0)
def change_value_on_press(self):
self.transport_price_value += 10
class Second(Screen):
def display_transport_price_value(self):
main_screen =
class MyTextInput(TextInput):
selected_text = StringProperty("")
# Use this prop. instead of 'selection_text'.
def cancel_selection(self):
self.selected_text = self.selection_text
super().cancel_selection()
Community Discussions
Trending Discussions on kivy
QUESTION
I'm having some trouble with some code I wrote that appears to work on the desktop, but when copied to my raspberry pi/touchscreen, I get a purely blank screen. Rpi has kivy installed. Kivy demos work just fine on both systems. Is there a chance there is something with import Window on kivy? Any advice would be greatly appreciated!
EDIT 1: I read online of someone else with a similar issue, needed to add (from kivy.lang.builder import Builder) and (Builder.load_file.py). I added this in the python code, which is letting me see most of the original program. Some of Kivy is showing, though for some reason- the graphic menu.png is missing and so is the textbox/grid layout at the bottom of the page (bottom of the kivy code below). This may be due to my positioning, so I will look into this.
Edit 2: This should be resolved- it was implementing Builder to the python code (correct version seen below). I also discovered- the raspberry pi might have an issue with images named 'menu.png'... Just changed the name of the image and everything was visible. No idea on that one. Thanks for the assistance.
Python Code:
...ANSWER
Answered 2022-Mar-23 at 03:26Had the same issue. Solved it by increasing the memory dedicated to the GPU on the Raspberry Pi.
Edit your /boot/config.txt
file (sudo
required)
Scroll down to the [all]
section, and edit the gpu_mem
line as follows:
gpu_mem=256
Then reboot your pi.
QUESTION
So, I'm working on a simple kivy app and I have three buttons (MDRaisedButton's
) which each open the same KivyMD Menu (MDDropdownMenu
) on release.
Two of these buttons are in different
ScreenManager
screens.The other button is in a
GridLayout
in theScreen
outside theScreenManager
.
When I open the menu using the buttons inside of the ScreenManager
, the menu appears at the button that is outside of the ScreenManager
, no matter which button I press.
So how can I change the caller, or the position of the menu when it appears to be that of the buttons in my ScreenManager
screens?
Me clicking on the button inside the ScreenManager
screen:
The menu appears on the wrong button:
Code:
...ANSWER
Answered 2022-Feb-21 at 18:49Look at the following line in your code for the MDRaisedButton on_release event handler.
QUESTION
I've a weird error using a simple notification testing app using android.
The error:
...ANSWER
Answered 2021-Sep-23 at 22:08I had the same problem and found the problem and a workaround, not the solution though:
The problem lies within the Drawable Object
created in the file plyer/platforms/android/notification.py
. If you print(dir(Drawable))
, you will find no attibute icon
(as the error message stated). I don't know why the icon attribute is missing, but you will find there is a presplash attribute instead (which is also a .png file and thus replaceable).
By changing line 100 in the notification.py
from app_icon = Drawable.icon
to app_icon = Drawable.presplash
, I could dodge the error and my app worked perfectly well. You need to change the line in the correct file though, which is located at ProjectName/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/projectname/plyer/platforms/android
.
QUESTION
I'm making a kivy app to find the rhyming words for a word entered by the user. It displays all the rhyming words as OneLineListItems
in an MDList
which is inside a kivy RecycleView
. On clicking on one of these OneLineListItems
it displays the definition of the word on the right-hand side of the screen. However, when I click on a OneLineListItem
its definition takes very long to appear and sometimes it lags so badly that the app closes. Am I doing something wrong or is it just my computer? Code below:
ANSWER
Answered 2022-Jan-25 at 08:32First create a custom class for the data-class like following:
QUESTION
'''
...ANSWER
Answered 2022-Jan-06 at 02:50You can use the text_size attribute, like this:
QUESTION
I have just seen that support for AAB files have just been introduced in Python for Android (p4a). Considering that, fom August 2021, new apps are required to publish with the Android App Bundle on Google Play, this is a crucial addition for any Python dev working on Android apps.
Since I'm currently using Buildozer via Docker, I'd like to know which are the steps to make it generating an .aab instead of (or along to) the traditional .apk
For the sake of clarity, here is what I use to run Buildozer from inside a container (using Docker for Windows) to make the .apk file:
...ANSWER
Answered 2021-Nov-26 at 13:34The community has finally completed the AAB support for Buildozer. Although it is still a pending pull request, it is already possible to create the AAB, and I have figured out how to do it using Docker.
I have found two very interesting gists that helped me a lot (this one about creating an AAB with Buildozer on Ubuntu, and another one about signing an AAB on the same platform). However, I have run everything on Windows via Docker, so I think it is a good idea to share how I did it.
Clone the feat/aab-support branch of the Buildozer repository in your local machine:
QUESTION
I don't understand why I can't install kivy.
I'm on Windows 10 64 bits with Python 3.10.
I have tried with pip
, pip3
, on administrator command, to install the master.zip
.
Always the same error (and same with Python 3.9)
Here the terminal print:
...ANSWER
Answered 2021-Nov-09 at 14:09After reading the document about kivy https://kivy.org/doc/stable-1.10.1/installation/installation-windows.html
Kivy can be installed with one of the following python versions:
- Python 2.7, 32-bit
- Python 3.4, 32-bit
- Python 3.5, 32-bit
- Python 3.6, 32-bit
- Python 2.7, 64-bit
- Python 3.4, 64-bit
- Python 3.5, 64-bit
- Python 3.6, 64-bit
QUESTION
I recently reinstalled python because weird stuff was happening with imports and virtual environments.
Now, when I try to install a library -- kivy, for example -- this happens:
...ANSWER
Answered 2021-Oct-09 at 22:10I do not know why it is getting stuck, but what I see is that you are using python 3.10, which is so fresh, that I had to go check to see if it is already released (it is! 5 days ago!).
kivy
does not have a wheel for 3.10, so it is trying to build one from the source, and crashes because of the missing kivy-deps.gstreamer-dev dependency, which is binary only and not available for python 3.10.
I deduce, that it is unlikely that you will be able to install kivy
with python 3.10. Try 3.9?
QUESTION
New to python - kivy - gui
im trying to get information from 1 class to another, the classes is basically the different screens i have for my GUI. ive research the return function but its not helping at all because im a noob.
main GUI running on .kv file this is a breakdown of my code.
...ANSWER
Answered 2021-Sep-25 at 16:48What you Need is global
variables. Did you know about scopes? In Short Global variable is a type of variable that can be accessed/Modified from anywhere in the code file. Here's an Example :
QUESTION
I want to set mdcard height
such that it fits mdlabel
, perhabs without me manually setting mdcard size.
please how do I do this.. Thanks in Advance..
For better understanding here's a sample code:
...ANSWER
Answered 2021-Sep-04 at 23:23You can set the height
of the MDCard
to be the same as the height
of the MDLabel
, but you must allow the MDLabel
to adjust to the size of its text
. Here is a modified version of your kv
that does that:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install kivy
You can use kivy like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page