How to create a bubble widget in Kivy

share link

by vigneshchennai74 dot icon Updated: Aug 24, 2023

technology logo
technology logo

Guide Kit Guide Kit  

A Kivy bubble is an essential component of the Python Kivy framework. That acts as a vAs demonstrated through examples like the TestBubbleApp. 

Developers can create engaging applications using Python Kivy. To help with learning, they can display Python Code and use Python Libraries to show data. Additionally, they can manage information using Python Arrays. The Kivy bubble offers a canvas for creativity. 

Consider a situation where a Python beginner sets out on an excursion to Learn Python. Following a Fledgling's Aide, this individual collaborates with a BubbleShowcase. That presents Python Code pieces and makes sense of Python Libraries bit by bit. The Air pocket gadget is intuitive, giving data on Python IDE choices. Then, it helps with the comprehension of Python Circles through continuous exhibitions. The BubbleShowcase's dynamic plan and movements make learning Python a connection with experience. 

Furthermore, the Kivy bubble goes beyond programming improvement and explores AI concepts. The air pocket can show the most common calculation method, like Fast Sort, on a list. We compare visual components to an Air pocket plot. It helps us understand complex arranging systems. This approach works with appreciation in any event. For unpredictable subjects, for example, drifting point numbers and Reach Python. 

Developers and builders use the Kivy bubble in different areas. These areas include Python Programming, AI, and intuitive Application improvement. The TestBubbleApp is versatile. It has models and grandstands and can reform training and application plans. Matplotlib helps envision information through Histograms.

The Kivy bubble enables engineers and students to picture ideas. Whether you're new or experienced, it's helpful to understand complex thoughts easily. The Kivy bubble remains a demonstration of the dynamic and boundless conceivable outcomes. Python provides a diverse ecosystem for development, with libraries like Tkinter and PyCharm. 

Preview of the output that you will get on running this code from your IDE


Kivy is an open-source Python library for rapid development of applications with innovative user interfaces, supporting multi-touch and cross-platform deployment.

from import App
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.bubble import Bubble, BubbleButton
from kivy.uix.label import Label
from import ObjectProperty
from kivy.lang import Builder

class CustomBubbleButton(BubbleButton):

class NumericKeyboard(Bubble):
    layout = ObjectProperty(None)

    def __init__(self, **kwargs):
        super(NumericKeyboard, self).__init__(**kwargs)

    def create_bubble_button(self):
        numeric_keypad = ['7', '8', '9', '4', '5', '6', '1', '2', '3', '', '0', '.']
        for x in numeric_keypad:
            if len(x) == 0:
                bubb_btn = CustomBubbleButton(text=str(x))

class BubbleShowcase(FloatLayout):
    text_input = ObjectProperty(None)

    def show_bubble(self, *l):
        if not hasattr(self, 'bubb'):
            self.bubb = bubb = NumericKeyboard()
            self.bubb.arrow_pos = "bottom_mid"


class TestBubbleApp(App):
    title = "Numeric Key Pad - Using Bubble"

    def build(self):
        return BubbleShowcase()

if __name__ == '__main__':

#:kivy 1.10.0

        app.root.text_input.text += self.text

    layout: layout

    size_hint: (None, None)
    size: (160, 120)
    pos_hint: {'center_x': .5, 'y': .6}

        id: layout
        cols: 3

    text_input: text_input

            rgba: 0, 1, 1, 1
            size: self.width, self.height
        id: text_input
        pos_hint: {'center_x': .5, 'y': .54}
        size_hint: (0.2, 0.06)
        cursor_blink: True
        font_size: 20
        multiline: False
  1. Download and install VS Code on your desktop.
  2. Open VS Code and create a new file in the editor.
  3. Copy the code snippet that you want to run, using the "Copy" button or by selecting the text and using the copy command (Ctrl+C on Windows/Linux or Cmd+C on Mac).,
  4. Paste the code into your file in VS Code, and save the file with a meaningful name and the appropriate file extension for Python use (.py).file extension.
  5. To run the code, open the file in VS Code and click the "Run" button in the top menu, or use the keyboard shortcut Ctrl+Alt+N (on Windows and Linux) or Cmd+Alt+N (on Mac). The output of your code will appear in the VS Code output console.
  6. Kivy library installation:
  7. Open your command prompt or terminal.
  8. Type the following command and press Enter: pip install Kivy
  9. Wait for the installation process to complete. This command will download and install the Kivy library and its dependencies.
  10. Once the installation is finished, you can import and use Kivy in your Python projects.
  11. Remember to ensure you have Python and pip (Python's package installer) installed on your system before attempting to install Kivy.
  12. Open in a text editor, and paste the Python code you provided earlier into this file.
  13. Open test.kv in the same text editor, and paste the Kivy language code you provided earlier into this file.
  14. Run the Python script on the file

I hope you have found this useful. I have added the version information in the following section.

I found this code snippet by searching " Kivy Python TextInput display Bubble" in Kandi. you can try any use case.

Environment Tested

I tested this solution in the following versions. Be mindful of changes when working with other versions.

  1. The solution is created and tested using Vscode 1.77.2 version
  2. The solution is created in Python 3.7.15 version
  3. The solution is created in Kivy 2.2.1

By utilizing this approach, we will modify the appearance of the Numeric Keyboard in a Kivy application using the Kivy library in Python. These modifications are easily attainable and enable us to create a refined version of the Numeric Keyboard in the Kivy app, empowering efficient data entry using the enhanced interface.


  1. For any support on kandi solution kits, please use the chat
  2. For further learning resources, visit the Open Weaver Community learning page.


1. What is the Kivy bubble and its link to Learn Python Programming? 

In the Kivy framework, a Kivy bubble is a visual element used for interactive interfaces. Kivy bubbles help you learn Python Code Libraries and concepts like Python Loops. They turn learning into a fun experience. 


2. How is bubble sort used in Python Kivy apps? 

Bubble sorting, a sorting method, is like arranging bubbles by size. It can organize elements like Bubble widgets or BubbleShowcase designs based on attributes. It helps make things look nice and neat. 


3. Common Python Array tricks for coding? 

Like lists, Python Arrays allow users to sort data using Quick Sort. You can use Python Loops to review items and count iterations with Python Count. They're like tools to solve problems. 


4. Why use Quick Sort in Kivy for data? 

Quick Sort is fast and fits Kivy's dynamic nature. As Kivy bubbles adapt to interactions, Quick Sort adapts to changing data. It's like tidying up things and making Kivy apps responsive and smooth.