Skip to content
This repository was archived by the owner on Dec 7, 2023. It is now read-only.
This repository was archived by the owner on Dec 7, 2023. It is now read-only.

My button on pressed not working I'm new in kivy and in the code when press the button it's does nothing. I have defined the on pressed function. I'm using pydroid 3 on Android Code is below  #7

Open
@JohnnyAidoo

Description

@JohnnyAidoo

import kivy
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.textinput import TextInput

class my_layout(BoxLayout):
def init (self, **kwargs):
super(). init (**kwargs)
self.rows=2

   self.tb = TextInput(
   text =''
   )
   
    self.add_widget(Label(text= 'hiii'))
    self.add_widget(Label(text= 'hiii'))
    
    self.bt1= Button(
    text= 'press me!'
    )
    self.bt1.bind(on_pressed = self.create)
    self.add_widget(self.bt1)

def create(self, instance):
    self.lbl =Label (text = 'i am label')
    self.add_widget(self.lbl)
    self.remove_widget(self.bt1)

class myApp(App):
def build(self):
return my_layout()

if True:
myApp().run()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions