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.

Help my button event is not working #6

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.floatlayout import FloatLayout

class layout(FloatLayout):
def init (self, **kwargs):
super(). init(**kwargs)

    b1 = Button(
    text = 'press me',
    pos_hint ={'x': 0.2 , 'y': 0.1},
    size_hint = (0.2, 0.1),
    )
    b1.bind(on_pressed =self.pressed)
    
    
    l1= Label(
    text = 'i am a label',
    color =(1,0,0,1)
    )
    self.add_widget(b1)
    self.add_widget(l1)
    
    
        
def pressed(self, elem):
    b1.text ='hiiiii'

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

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