Есть ли способ создать всплывающее окно с пузырьками (Bubble), которое можно использовать для ввода текста для обоих полей ( Mulyiplier i , x)?

Multiplier i - значение постоянное, но иногда будет меняться.

multiplier x - значение всегда меняется.К сожалению у меня получилось создать клавиатуру только для одного поля ввода, а для второго не получается.Помогите пожалуйста.

main.py

i=0            
x=0            
layer=0                     
list_num=[]    
listnum=[]     
general_list=[] 
     
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.gridlayout import GridLayout
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.bubble import Bubble, BubbleButton
from kivy.core.window import Window
from kivy.lang import Builder

Window.size=(480, 853)

class CustomBubbleButton(BubbleButton):              
    
    def add_text(self):  
        app= App.get_running_app()
        index=app.root.text_input_x.cursor[0]-1
        
        if self.text!= u"\u00AB": 
            app.root.text_input_x.text= app.root.text_input_x.text[:index+1]+self.text + app.root.text_input_x.text[index+1:]  
            app.root.text_input_x.cursor=(index+2,0)
            app.root.text_input_x.text= app.root.text_input_x.text[:7 - len(self.text)]   

        else:
            app.root.text_input_x.text=app.root.text_input_x.text[:index] + app.root.text_input_x.text[index+1:]
            app.root.text_input_x.cursor=(index,0)
 
    pass

class NumericKeyboard( Bubble):             

    def on_touch_up(self, touch):          
        
        app= App.get_running_app()
        if  not self.collide_point(*touch.pos) and not\
        app.root.text_input_x.collide_point(*touch.pos) :             
            app.root.remove_widget(app.root.bubb) 
            app.root.text_input_x.focus=False
            app.root.text_input_i.focus=False
            
            delattr (app.root, 'bubb')  
                           
    def __init__(self, **kwargs):            
        super(NumericKeyboard, self).__init__(**kwargs) 
        self.create_bubble_button()    

    def create_bubble_button(self):      
        numeric_keypad = ['7', '8', '9', '4', '5', '6', '1', '2', '3', '.', '0', u"\u00AB"]
        for x in numeric_keypad:
            bubb_btn = CustomBubbleButton(text=str(x) ) 
            self.layout.add_widget(bubb_btn)  
            
class Container(FloatLayout):    

    def show_bubble(self, *l):               
        if not hasattr(self, 'bubb'):       
            self.bubb = NumericKeyboard()    
            self.bubb.arrow_pos = "top_mid"  
            self.add_widget(self.bubb)                 
                
    def calculate(self):        
        try: 
            i= float(self.text_input_i.text)  
            x= float(self.text_input_x.text)  
                        
        except:            
            i=0     
            x=0    
                
        layer=float(round(x*i,2))  
                
        list_num.append(x),
                
        self.order_length.text =  f'{self.text_input_x.text}'
        general_list.append(self.order_length.text)   

        my_string = '\n'.join(general_list)
        self.general_list.text = f'{my_string}'
        
        self.text_input_x.text = '' 
            
class MyApp(App):
        
    def build(self):        
        return Container()

if __name__ == '__main__':
    app=MyApp().run()

my.kv

<CustomBubbleButton>:   
    font_size: "32sp"
    on_release: root.add_text()
   

<NumericKeyboard>:         
    padding:10
    layout: layout
    size_hint: (0.7, 0.32)   #0.95
    pos_hint: {'x': 0, 'y': 0}    #{'center_x': 0.5, 'y': 0}

    GridLayout:
        id: layout
        cols: 3
        padding:10
        spacing:10

        
<Container>:               
    
    #size: root.width, root.height
    canvas.before:            
        Color:
            rgba:(44/255,29/255,25/255,1)
        Rectangle:
            pos:self.pos
            size:self.size
            
    rows:3
    padding:10
    spacing:10
    
        
    text_input_x: text_input_x      
    text_input_i: text_input_i                
    general_list: general_list
    order_length: order_length
                
    GridLayout:            ##################
        size_hint: 1, 0.14    #0.2
        pos_hint: {'center_x': 0.5, 'y': 0.78} 
        cols: 2
        spacing:10
  
        Label:
            size_hint_x: 2   
            text: "Multiplier i ->"
            font_size: '25sp'
            
        TextInput:               
            id: text_input_i
            
            text_size: self.width, None
            text: '10'
            multiline: False
            font_size: '20sp'
            cursor_blink: True
            input_type: 'number'
            input_filter: 'float'
            input_filter: lambda text, from_undo: text[:6 - len(self.text)]    
            on_focus: root.show_bubble()
                
        Label:
            size_hint_x: 2   
            text: "Multiplier x ->"
            font_size: '25sp'
            
        
        TextInput:
            id: text_input_x            
            
            text_size: self.width, None
            text: ''
            multiline: False
            font_size: '20sp'
            cursor_blink: True
            input_type: 'number'
            input_filter: 'float'
            input_filter: lambda text, from_undo: text[:6 - len(self.text)]   
            on_focus: root.show_bubble()
            
    GridLayout:               #################
        rows:3
        size_hint: 1, 0.62     
        pos_hint: {'center_x': 0.5, 'y': 0.15}   
        spacing:10
        
        Label:
            background_normal:''
            background_color:(0,0,0,0)                        
            canvas.before:
                Color:
                    rgba:(158/255,126/255,93/255,1)
                RoundedRectangle:
                    size:self.size
                    pos:self.pos
                    radius:[15]
            id: order_length     
            
            size_hint_y: None
            height: self.texture_size[1]
            text_size: self.width, None
            text: 'Is equal to: '
            font_size:'20sp'
            padding:10,10
            multiline: True  
           
        ScrollView:
            scroll_type:['bars', 'content']
            bar_width:15
            Label:
                background_normal:''
                background_color:(0,0,0,0)                        #(158/255,126/255,93/255,1)
                canvas.before:
                    Color:
                        rgba:(48/255,84/255,150/255,1)
                    RoundedRectangle:
                        size:self.size
                        pos:self.pos
                        radius:[15]
                id: general_list           

                size_hint_y: None
                height: self.texture_size[1]
                text_size: self.width, None
                text: 'List:' 
                font_size:'20sp'
                padding:10,10
        
    GridLayout:   
        rows:2
        spacing:10
        size_hint: 1, 0.14      
        pos_hint: {'center_x': 0.5, 'y': 0} 
    
        BoxLayout:
            
            spacing:10
            
            Button:                

                font_size: '32sp'
                text: u"\u00AB"
                   
            Button:
                
                text: "Is equal to"
                font_size: '17sp'

                on_release:                     
                    root.calculate()
                    root.show_bubble()

Ответы (0 шт):